ESP_IOT v2.5
IOT ESP Coding
PreferencesController.cpp
Go to the documentation of this file.
1
2#include "../../Defines.h"
4//! PREFERENCES for the main module
5//1075325 vs 1074301
6//1075781 after refactor (removed stpper preferences)
7//1075833
8
9//!for returning a 'String" NOTE: THIS IS NOT GREAT .. as if you don't grab it before another query, and use it -- the result might be 1 instead of deviceName..
11//!buffer for the string
13
14
15//!Issue #103
16//!NOTE: the EPROM space might be limiting: https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/default.csv
17//!to 4KB .. https://www.esp32.com/viewtopic.php?t=9136
18//! So we should start limiting our use, and start with these string indexes..
19//! main module preferences
20//! gateway is on THESE MUST ALL BE UNIQUE
21#define EPROM_MAIN_GATEWAY_VALUE "1gt"
22//!BLEServer mode
23#define EPROM_MAIN_BLE_SERVER_VALUE "2bs"
24//!BLEClient mode
25#define EPROM_MAIN_BLE_CLIENT_VALUE "3bc"
26
27//!buzzer on or off
28#define EPROM_STEPPER_BUZZER_VALUE "4bz"
29//! single feed mode
30#define EPROM_STEPPER_SINGLE_FEED_VALUE "5sf"
31//!auto feed
32#define EPROM_STEPPER_AUTO_FEED_VALUE "6af"
33//!jackpot feed
34#define EPROM_STEPPER_JACKPOT_FEED_VALUE "7jf"
35//! the step kind
36#define EPROM_STEPPER_KIND_VALUE "8sk"
37//num feeds in jackpot mode
38#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE "9jp"
39//! sensor preferences for tilt on or off
40#define EPROM_SENSOR_TILT_VALUE "TILT_10" //10tt"
41 //!proximity PIR
42#define EPROM_SENSOR_PIR_VALUE "11pr"
43//! display preferences zoomed or not zoomed
44#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE "12sz"
45
46//! Display preferences - show messages on blank screen- boolean
47#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE "13bk"
48//! sets the timeout value
49#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE "14to"
50//! sets the max temp for a poweroff
51#define EPROM_HIGH_TEMP_POWEROFF_VALUE "15pw"
52//!whether to show the minimal or expanded menu
53#define EPROM_IS_MINIMAL_MENU_SETTING "16mm"
54//! sets stepper angle, a floating point number
55#define EPROM_STEPPER_ANGLE_FLOAT_SETTING "17sa"
56
57//! sets screentimeout if not button clicks (set,noclick,val,seconds)
58#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING "18po"
59
60//!for now, save 2 WIFI Credentials
61#define EPROM_WIFI_CREDENTIAL_1_SETTING "19w1"
62//!second wifi credential
63#define EPROM_WIFI_CREDENTIAL_2_SETTING "20w2"
64
65//! the guest device paired with this M5 device (or NONE)
66#define EPROM_PAIRED_DEVICE_SETTING "21pd"
67
68//! the device name
69#define EPROM_DEVICE_NAME_SETTING "22dn"
70
71//!a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE
72#define EPROM_FIRST_TIME_FEATURE_SETTING "23fs"
73
74//! if true, only BLEClient connect to GEN3 feeders..
75#define EPROM_ONLY_GEN3_CONNECT_SETTING "23gs"
76
77//!color of the M5 screen
78#define EPROM_SCREEN_COLOR_SETTING "24sc"
79
80//!if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
81#define EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING "25bs"
82//!if set, the BLE Client will look for its service base name (PTFeeder or PTClicker), but if that name
83//!also has an extension (:ScoobyDoo), and this is set, it will only connect if the PREFERENCE_PAIRED_DEVICE_SETTING has the same device name in the discovered name
84#define EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING "26bd"
85//!NOTE: these EPROM have to be lockstep the same as the PREFERENCE definitions in MainModule.h
86
87#define EPROM_USE_DOC_FOLLOW_SETTING "27df"
88
89//! 8.17.22 to turn on/off subscribing to the dawgpack topic
90#define EPROM_SUB_DAWGPACK_SETTING "28dg"
91
92//! 8.22.22 to turn on/off SPIFF use
93#define EPROM_USE_SPIFF_SETTING "29sf"
94
95//! 9.3.22 eprom of the Address of desired BLE
96#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING "30da"
97
98//!retreives the motor direction| true default, clockwise; false = REVERSE, counterclockwise 9.8.22
99//! false = reverse == counterclockwise
100//! true = default
101#define EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING "31md"
102
103//!send WIFI to all except our device (and our paired) when
104#define EPROM_SENDWIFI_WITH_BLE "32wb"
105
106//! starts the BLE Discovery notification process - which might be internal or externa (via messages).
107#define EPROM_NOTIFY_BLE_DISCOVERY "33bd"
108
109//! the preference timer
110#define EPROM_PREFERENCE_TIMER_INT_SETTING "34tm"
111
112//!the EPROM is in preferences.h
113#include <Preferences.h>
114//!name of main prefs eprom
115#define PREFERENCES_EPROM_MAIN_NAME "MainPrefs"
116
117//! preferences for MAIN
119//!array of preference names (those used in process()
121//!array of default values to store in the EPROM if not defined..
123//!initialize the _preferencesMainLookup with EPROM lookup names
125
126//!Cache for heavy hitter boolean values (those referenced every loop.. seems to be hard on the EPROM to keep up:
127//! This array will only have the Boolean values set.. the 'save' will fill them, and the 'get' will return
129
130//!array of boolean if the ID is cached..
132
133//! another cache for the Int values..
135
136//!array of boolean if the ID is cached..
138
139//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
140void savePreference_mainModule(int preferenceID, String preferenceValue)
141{
142 SerialLots.printf("savePreference .. %d, %s\n", preferenceID, preferenceValue);
143 // cannot invoke the preference, as this would be an infinite loop back to here..
144
145 //save in EPROM
146 _preferencesMainModule.begin(PREFERENCES_EPROM_MAIN_NAME, false); //readwrite..
147 _preferencesMainModule.putString(_preferenceMainModuleLookupEPROMNames[preferenceID], preferenceValue);
148
149 // Close the Preferences
151
152}
153
154//!sets an int preference
155void savePreferenceInt_mainModule(int preferenceID, int val)
156{
157 if (_isCachedPreferenceInt[preferenceID])
158 {
159 //! CACHE SETTINGS 1
160 _cachedPreferenceIntValues[preferenceID] = val;
161 }
162
163 //!convert to a string..
164 char str[20];
165 sprintf(str,"%d",val);
166 savePreference_mainModule(preferenceID, str);
167}
168
169//!sets an int, but only if a valid integer, and no signs. If bad, then a 0 is stored
170void savePreferenceIntFromString_mainModule(int preferenceID, char* val)
171{
172 //This function returns the converted integral number as an int value. If no valid conversion could be performed, it returns zero.
173 int num = atoi(val);
174 savePreferenceInt_mainModule(preferenceID, num);
175}
176
177//!toggles a preference boolean
179{
180 boolean val = getPreferenceBoolean_mainModule(preferenceID);
181 val = !val;
182 savePreferenceBoolean_mainModule(preferenceID, val);
183}
184
185
186
187//! called to get a preference (which will be an identifier and a string, which can be converted to a number or boolean)
188//! Note: no CACHE is looked at here. It's up to the Boolean or Int to do that..
189char* getPreference_mainModule(int preferenceID)
190{
191 // cannot invoke the preference, as this would be an infinite loop back to here..
192
193 //!get from EPROM
195
196 strcpy(_preferenceBuffer, _preferencesMainModule.getString( _preferenceMainModuleLookupEPROMNames[preferenceID]).c_str());
197
198 // Close the Preferences
200 return _preferenceBuffer;
201}
202
203
204//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
205boolean getPreferenceBoolean_mainModule(int preferenceID)
206{
207 boolean valBool;
208 // check some of the boolean ones
209 if (_isCachedPreferenceBoolean[preferenceID])
210 {
211 //! CACHE SETTINGS 5
212 valBool = _cachedPreferenceBooleanValues[preferenceID];
213 SerialLots.print(" CACHE preference = ");
214 SerialLots.printf(" [%d] = ",preferenceID);
215 SerialLots.println(valBool);
216 }
217 else
218 {
219 char* val = getPreference_mainModule(preferenceID);
220 SerialLots.print(" preference = ");
221 SerialLots.printf(" [%d] = ",preferenceID);
222 SerialLots.println(val);
223 valBool = (strcmp(val,"1")==0)?true:false;
224 }
225 return valBool;
226}
227
228//! save a boolean preference
229void savePreferenceBoolean_mainModule(int preferenceID, boolean flag)
230{
231 if (_isCachedPreferenceBoolean[preferenceID])
232 {
233 //! CACHE SETTINGS 5
234 _cachedPreferenceBooleanValues[preferenceID] = flag;
235
236 SerialLots.print(" set CACHE preference");
237 SerialLots.printf(" [%d] = ",preferenceID);
238 SerialLots.println(flag);
239 }
240
241 savePreference_mainModule(preferenceID, flag?(char*)"1":(char*)"0");
242}
243
244
245
246//!returns the preference but in it's own string buffer. As long as you use it before calling getPreferenceString again, it won't be overwritten
247char* getPreferenceString_mainModule(int preferenceID)
248{
251}
252//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
253int getPreferenceInt_mainModule(int preferenceID)
254{
255 int ival = 0;
256 if (_isCachedPreferenceInt[preferenceID])
257 {
258 ival = _cachedPreferenceIntValues[preferenceID];
259 }
260 else
261 {
262 ival = atoi(getPreference_mainModule(preferenceID));
263 }
264
265 return ival;
266}
267
268//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
269float getPreferenceFloat_mainModule(int preferenceID)
270{
271 char* val = getPreference_mainModule(preferenceID);
272 float fval = atof(val);
273 return fval;
274}
275//! clean the preferencesMainModule in EPROM
277{
278 _preferencesMainModule.begin(PREFERENCES_EPROM_MAIN_NAME, false); //readwrite..
281}
282
283//!set some defaults on boot - that override EPROM
284//!This is also called when going back tot he MAIN menu (HOME SCREEN)
286{
287 SerialTemp.println("setOnBootPreferences_mainModule");
288 //!set zoomed = true (no semantic marker)
290
291 //!use the minimal menu on boot
293
294
295}
296
297//! reads the preferences. Save is everytime the savePreference is called
299{
300 SerialDebug.printf("readPreferences_mainModule(%s)\n",PREFERENCES_EPROM_MAIN_NAME);
301
302 //!clean the cached, and initialize what are cached..
303 for (int i = 0; i < MAX_MAIN_PREFERENCES; i++)
304 {
308 _isCachedPreferenceInt[i] = false;
309 }
310
311 //!intiialize the preferences arrays from EPROM. This also updates the defaults
312 //! BUT: the caches below are from the value retrieved (and defult if need be)
314
315 //!start the read-write of the EPROM
316 _preferencesMainModule.begin(PREFERENCES_EPROM_MAIN_NAME, false); //readwrite..
317
318 for (int i = 0; i < MAX_MAIN_PREFERENCES; i++)
319 {
320 String preferenceValue;
321 int preferenceID = i;
322 preferenceValue = _preferencesMainModule.getString(_preferenceMainModuleLookupEPROMNames[preferenceID]);
323 if (preferenceValue && preferenceValue.length() > 0)
324 {
325 // already set
326 }
327 else
328 {
329 //otherwise go to the preference defaults
330 preferenceValue = _preferenceMainModuleLookupDefaults[i];
331 _preferencesMainModule.putString(_preferenceMainModuleLookupEPROMNames[preferenceID], preferenceValue);
332 }
333 SerialTemp.printf("Preference[%s] = ",_preferenceMainModuleLookupEPROMNames[preferenceID]);
334 SerialTemp.println(preferenceValue);
335
336 //! check some of the boolean ones to cache .. so don't have to go to the EPROM everytime..
337 switch (i)
338 {
339 //!**** NOTE: THis is where whether things are cached or not is set! Eventually all boolean and int could be cached..
340 //! CACHE SETTINGS (boolean)
350 _cachedPreferenceBooleanValues[i] = (preferenceValue.compareTo("1")==0)?true:false;
351 break;
352 //! CACHE SETTINGS (int)
356 _isCachedPreferenceInt[i] = true;
357 _cachedPreferenceIntValues[i] = atoi(&preferenceValue[0]);
358 break;
359
360 default:
361 break;
362 }
363 }
364 //! Close the Preferences
366
367 //! set onbootPreferences
369
370}
371
372//!initialize the _preferencesMainLookup with EPROM lookup names
373//!BUT these are not stored in EPROM. The next method
375{
376
377 strcpy(_preferenceBufferString,(char*)"");
378 strcpy(_preferenceBuffer,(char*)"");
379
380 for (int i = 0; i < MAX_MAIN_PREFERENCES; i++)
381 {
382 switch (i)
383 {
386#ifdef ESP_M5
387#ifdef ESP_M5_CAMERA
388 //!default on for the M5 Camera (but it can be turned on later..)
390#else
391 //! 12.8.22 default back TRUE
392 //!default off for the M5 (but it can be turned on later..)
394#endif
395#else
397#endif
398 break;
401#ifdef ESP_M5
403#else
405#endif
406 break;
407 //! Sensor preferences
411 break;
416 break;
417 //!used for first time features..
421 //! This is a feeder that gateways to a GEN3
422#ifdef ESP_32_FEEDER_BLE_GEN3
424#else
425 //! This is a feeder that gateways to a GEN3
427#endif
428 break;
429
430 //INT SETTINGS..
435 break;
436
437
438 //! REST ARE NOT CACHED
439 //These are hard coded default values for the preferences
443 break;
444
445 //! STEPPER preferences (no ifdef.. )
449 break;
453 break;
457 break;
462 break;
466 break;
470 break;
474 break;
478 break;
479
483 break;
487 break;
491 break;
494 _preferenceMainModuleLookupDefaults[i] = (char*)"480";
495 break;
499 break;
504 break;
508 _preferenceMainModuleLookupDefaults[i] = (char*)"NONE";
509 break;
513 _preferenceMainModuleLookupDefaults[i] = (char*)"NONE";
514 break;
518 _preferenceMainModuleLookupDefaults[i] = (char*)"NONE";
519 break;
523#ifdef ESP_M5
524#ifdef ESP_M5_CAMERA
525 _preferenceMainModuleLookupDefaults[i] = (char*)"M5Camera";
526#else
528#endif
529#else
530 _preferenceMainModuleLookupDefaults[i] = (char*)"ESP32";
531#endif
532 break;
533
534 //!set with message: set:bleusedevicename,val:on/off
537 //! 12.8.22 setting to TRUE as default
539#ifdef ESP_M5
540 //! 1.6.23 .. PetTutor Blue app still not always discovering new syntax
542#else
544#endif
545 break;
546 //!set with message: set:bleusepaireddevicename,val:on/off
550 break;
551
555 break;
556 //!used for first time features..
561 break;
562
563 //! 8.17.22 to turn on/off subscribing to the dawgpack topic
567#ifdef ESP_M5
569#else
571#endif
572 break;
573
574 //!//! 8.22.22 to turn on/off SPIFF use (not cached yet as it's an infrequent event)
578#ifdef ESP_M5_CAMERA
580#else
582
583#endif
584 break;
585
586 //!the paired device for guest device feeding (6.6.22) .. but the Address 9.3.22
591
592 break;
593
594 ///!retreives the motor direction| 0 (false) = default, clockwise; 1 (true) = REVERSE, counterclockwise 9.8.22
595 //! TRUE = reverse == counterclockwise
596 //! FALSE = default
601
602 break;
603
604 //! 10.4.22
609
610 break;
611
612 //! 11.1.22 TODO.. messages for this..
617
618 break;
619 default:
620 SerialError.printf(" ** NO default for preference[%d]\n", i);
621 }
622 }
623}
624
625
626//!print the preferences to SerialDebug
628{
629#ifdef SERIAL_DEBUG_TEMP
630 SerialTemp.println("******************");
631 SerialTemp.println(VERSION);
632 //ouch.. this sets 2 values ..
633 // readPreferences_mainModule();
634 SerialTemp.printf("STEPPER_KIND: %d\n", getPreferenceInt_mainModule(PREFERENCE_STEPPER_KIND_VALUE));
635 SerialTemp.printf("PREFERENCE_TIMER_INT_SETTING: %d\n", getPreferenceInt_mainModule(PREFERENCE_TIMER_INT_SETTING));
636 SerialTemp.printf("STEPPER_AUTO_FEED: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_STEPPER_AUTO_FEED_VALUE));
637 SerialTemp.printf("STEPPER_JACKPOT_FEED: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_STEPPER_JACKPOT_FEED_VALUE));
638 SerialTemp.printf("PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING: %f\n", getPreferenceFloat_mainModule(PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING));
639 SerialTemp.printf("STEPPER_FEEDS_PER_JACKPOT: %d\n", getPreferenceInt_mainModule(PREFERENCE_STEPPER_FEEDS_PER_JACKPOT));
640 SerialTemp.printf("DISPLAY_SCREEN_TIMEOUT: %d\n", getPreferenceInt_mainModule(PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE));
641 SerialTemp.printf("PREFERENCE_HIGH_TEMP_POWEROFF_VALUE: %d\n", getPreferenceInt_mainModule(PREFERENCE_HIGH_TEMP_POWEROFF_VALUE));
642 SerialTemp.printf("PREFERENCE_IS_MINIMAL_MENU_SETTING: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_IS_MINIMAL_MENU_SETTING));
643 SerialTemp.printf("PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE));
644 SerialTemp.printf("PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING: %d\n", getPreferenceInt_mainModule(PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING));
645 SerialTemp.printf("PREFERENCE_MAIN_GATEWAY_VALUE: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_MAIN_GATEWAY_VALUE));
646 SerialTemp.printf("PREFERENCE_SENSOR_TILT_VALUE: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_SENSOR_TILT_VALUE));
647 SerialTemp.printf("WIFI_CREDENTIAL_1: %s\n", getPreference_mainModule(PREFERENCE_WIFI_CREDENTIAL_1_SETTING));
648 SerialTemp.printf("WIFI_CREDENTIAL_2: %s\n", getPreference_mainModule(PREFERENCE_WIFI_CREDENTIAL_2_SETTING));
649 SerialTemp.printf("PREFERENCE_PAIRED_DEVICE_SETTING: %s\n", getPreference_mainModule(PREFERENCE_PAIRED_DEVICE_SETTING));
650 SerialTemp.printf("PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING: %s\n", getPreference_mainModule(PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING));
651 SerialTemp.printf("PREFERENCE_DEVICE_NAME_SETTING: %s\n", getPreference_mainModule(PREFERENCE_DEVICE_NAME_SETTING));
652 SerialTemp.printf("PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING));
653
654 SerialTemp.printf("PREFERENCE_MAIN_BLE_CLIENT_VALUE: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_MAIN_BLE_CLIENT_VALUE));
655 SerialTemp.printf("PREFERENCE_MAIN_BLE_SERVER_VALUE: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_MAIN_BLE_SERVER_VALUE));
656 SerialTemp.printf("PREFERENCE_FIRST_TIME_FEATURE_SETTING: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_FIRST_TIME_FEATURE_SETTING));
657 SerialTemp.printf("PREFERENCE_SCREEN_COLOR_SETTING: %d\n", getPreferenceInt_mainModule(PREFERENCE_SCREEN_COLOR_SETTING));
658
659 SerialTemp.printf("PREFERENCE_SUB_DAWGPACK_SETTING: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_SUB_DAWGPACK_SETTING));
660 SerialTemp.printf("PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING));
661 SerialTemp.printf("PREFERENCE_SENDWIFI_WITH_BLE: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_SENDWIFI_WITH_BLE));
662 SerialTemp.printf("PREFERENCE_ONLY_GEN3_CONNECT_SETTING: %d\n", getPreferenceBoolean_mainModule(PREFERENCE_ONLY_GEN3_CONNECT_SETTING));
663
664 SerialTemp.printf("WIFI_CREDENTIAL: %s\n", main_JSONStringForWIFICredentials());
665 //!retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
666
667#endif
668}
669
670
671//!resets preferences.. Currently only reset all, but eventually reset(groups..)
673{
674// savePreferenceBoolean_mainModule(PREFERENCE_SENDWIFI_WITH_BLE, false);
675// savePreferenceInt_mainModule(PREFERENCE_TIMER_INT_SETTING, 30);
676
677 SerialLots.println("Clean EPROM.. ");
678 //! dispatches a call to the command specified. This is run on the next loop()
680
681}
682
683boolean _DiscoverM5PTClicker = false;
684//!transient for now... 10.4.22
685//! set the M5 PTClicker discovery option..
686void setDiscoverM5PTClicker(boolean flag)
687{
688 SerialTemp.println("Setting _DiscoverM5PTClicker");
690}
691//! get option
693{
695}
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
Definition: MainModule.cpp:663
void main_dispatchAsyncCommand(int asyncCallCommand)
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
Definition: MainModule.cpp:789
#define NO_POWEROFF_AMOUNT_STRING_MAIN
Definition: MainModule.h:45
#define ASYNC_CALL_CLEAN_EPROM
cleans the EPROM totally, and reboots
Definition: MainModule.h:145
#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING
sets screentimeout if not button clicks (set,noclick,val,seconds)
#define EPROM_MAIN_GATEWAY_VALUE
void cleanEPROM_mainModule()
clean the preferencesMainModule in EPROM
void savePreferenceInt_mainModule(int preferenceID, int val)
sets an int preference
boolean getDiscoverM5PTClicker()
get option
float getPreferenceFloat_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
#define EPROM_WIFI_CREDENTIAL_2_SETTING
second wifi credential
void savePreferenceBoolean_mainModule(int preferenceID, boolean flag)
save a boolean preference
#define EPROM_FIRST_TIME_FEATURE_SETTING
a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE
#define EPROM_PAIRED_DEVICE_SETTING
the guest device paired with this M5 device (or NONE)
char * _preferenceMainModuleLookupDefaults[MAX_MAIN_PREFERENCES]
array of default values to store in the EPROM if not defined..
char _preferenceBuffer[100]
PREFERENCES for the main module.
#define EPROM_STEPPER_ANGLE_FLOAT_SETTING
sets stepper angle, a floating point number
#define EPROM_USE_DOC_FOLLOW_SETTING
NOTE: these EPROM have to be lockstep the same as the PREFERENCE definitions in MainModule....
char * _preferenceMainModuleLookupEPROMNames[MAX_MAIN_PREFERENCES]
array of preference names (those used in process()
#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING
9.3.22 eprom of the Address of desired BLE
void setDiscoverM5PTClicker(boolean flag)
#define EPROM_SENDWIFI_WITH_BLE
send WIFI to all except our device (and our paired) when
#define EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING
if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
void resetAllPreferences_mainModule()
resets preferences.. Currently only reset all, but eventually reset(groups..)
#define EPROM_STEPPER_BUZZER_VALUE
buzzer on or off
#define EPROM_MAIN_BLE_SERVER_VALUE
BLEServer mode.
#define EPROM_STEPPER_SINGLE_FEED_VALUE
single feed mode
#define EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING
boolean getPreferenceBoolean_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void togglePreferenceBoolean_mainModule(int preferenceID)
toggles a preference boolean
#define EPROM_USE_SPIFF_SETTING
8.22.22 to turn on/off SPIFF use
#define EPROM_SCREEN_COLOR_SETTING
color of the M5 screen
#define EPROM_ONLY_GEN3_CONNECT_SETTING
if true, only BLEClient connect to GEN3 feeders..
boolean _isCachedPreferenceBoolean[MAX_MAIN_PREFERENCES]
array of boolean if the ID is cached..
#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE
#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE
Display preferences - show messages on blank screen- boolean.
#define EPROM_SENSOR_PIR_VALUE
proximity PIR
void savePreferenceIntFromString_mainModule(int preferenceID, char *val)
sets an int, but only if a valid integer, and no signs. If bad, then a 0 is stored
void setOnBootPreferences_mainModule()
set some defaults on boot - that override EPROM this can be called on the HOME screen to set back to ...
char _preferenceBufferString[100]
buffer for the string
#define EPROM_PREFERENCE_TIMER_INT_SETTING
the preference timer
boolean _cachedPreferenceBooleanValues[MAX_MAIN_PREFERENCES]
#define EPROM_STEPPER_JACKPOT_FEED_VALUE
jackpot feed
#define EPROM_SUB_DAWGPACK_SETTING
8.17.22 to turn on/off subscribing to the dawgpack topic
#define EPROM_NOTIFY_BLE_DISCOVERY
starts the BLE Discovery notification process - which might be internal or externa (via messages).
Preferences _preferencesMainModule
preferences for MAIN
#define EPROM_SENSOR_TILT_VALUE
sensor preferences for tilt on or off
#define EPROM_STEPPER_KIND_VALUE
the step kind
#define EPROM_HIGH_TEMP_POWEROFF_VALUE
sets the max temp for a poweroff
#define EPROM_STEPPER_AUTO_FEED_VALUE
auto feed
#define EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING
#define PREFERENCES_EPROM_MAIN_NAME
the EPROM is in preferences.h
#define EPROM_WIFI_CREDENTIAL_1_SETTING
for now, save 2 WIFI Credentials
#define EPROM_MAIN_BLE_CLIENT_VALUE
BLEClient mode.
#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE
sets the timeout value
int getPreferenceInt_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
int _cachedPreferenceIntValues[MAX_MAIN_PREFERENCES]
another cache for the Int values..
char * getPreference_mainModule(int preferenceID)
#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE
display preferences zoomed or not zoomed
boolean _DiscoverM5PTClicker
char * getPreferenceString_mainModule(int preferenceID)
returns the preference but in it's own string buffer. As long as you use it before calling getPrefere...
void printPreferenceValues_mainModule()
print the preferences to SerialDebug
#define EPROM_IS_MINIMAL_MENU_SETTING
whether to show the minimal or expanded menu
#define EPROM_DEVICE_NAME_SETTING
the device name
boolean _isCachedPreferenceInt[MAX_MAIN_PREFERENCES]
array of boolean if the ID is cached..
void initPreferencesMainModule()
initialize the _preferencesMainLookup with EPROM lookup names
void savePreference_mainModule(int preferenceID, String preferenceValue)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void readPreferences_mainModule()
reads the preferences. Save is everytime the savePreference is called
#define PREFERENCE_USE_SPIFF_SETTING
8.22.22 to turn on/off SPIFF use
#define PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING
the paired device for guest device feeding (6.6.22) .. but the Address 9.3.22
#define PREFERENCE_STEPPER_KIND_VALUE
uses STEPPER type
#define PREFERENCE_SENSOR_TILT_VALUE
Sensor preferences.
#define PREFERENCE_SUB_DAWGPACK_SETTING
8.17.22 to turn on/off subscribing to the dawgpack topic
#define PREFERENCE_STEPPER_SINGLE_FEED_VALUE
#define PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING
if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
#define PREFERENCE_ONLY_GEN3_CONNECT_SETTING
if true, only BLEClient connect to GEN3 feeders..
#define PREFERENCE_SENDWIFI_WITH_BLE
sends the WIFI to all except current device if set
#define PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING
#define PREFERENCE_SENSOR_PIR_VALUE
#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE
Display preferences (SemanticMarker etc) - boolean.
#define PREFERENCE_STEPPER_JACKPOT_FEED_VALUE
#define PREFERENCE_WIFI_CREDENTIAL_2_SETTING
#define PREFERENCE_MAIN_BLE_SERVER_VALUE
#define PREFERENCE_PAIRED_DEVICE_SETTING
the paired device for guest device feeding (6.6.22)
#define PREFERENCE_STEPPER_BUZZER_VALUE
stepper preferences
#define MAX_MAIN_PREFERENCES
******* 1 greater than last value **** IMPORTANT *** and no gaps..
#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING
#define PREFERENCE_USE_DOC_FOLLOW_SETTING
for
#define PREFERENCE_WIFI_CREDENTIAL_1_SETTING
#define PREFERENCE_FIRST_TIME_FEATURE_SETTING
a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE
#define PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE
sets the timeout value
#define PREFERENCE_DISPLAY_ON_BLANK_SCREEN_VALUE
Display preferences - show messages on blank screen- boolean.
#define PREFERENCE_IS_MINIMAL_MENU_SETTING
sets the max temp for a poweroff
#define PREFERENCE_SCREEN_COLOR_SETTING
ithe color of the screen 0..n
#define PREFERENCE_NOTIFY_BLE_DISCOVERY
starts the BLE Discovery notification process - which might be internal or externa (via messages).
#define PREFERENCE_DEVICE_NAME_SETTING
the device name itself (6.6.22)
#define PREFERENCE_HIGH_TEMP_POWEROFF_VALUE
sets the max temp for a poweroff
#define PREFERENCE_STEPPER_FEEDS_PER_JACKPOT
#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING
#define PREFERENCE_MAIN_GATEWAY_VALUE
#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define PREFERENCE_MAIN_BLE_CLIENT_VALUE
#define PREFERENCE_TIMER_INT_SETTING
the preference timer
#define PREFERENCE_STEPPER_AUTO_FEED_VALUE