2#include "../../Defines.h"
21#define EPROM_MAIN_GATEWAY_VALUE "1gt"
23#define EPROM_MAIN_BLE_SERVER_VALUE "2bs"
25#define EPROM_MAIN_BLE_CLIENT_VALUE "3bc"
28#define EPROM_STEPPER_BUZZER_VALUE "4bz"
30#define EPROM_STEPPER_SINGLE_FEED_VALUE "5sf"
32#define EPROM_STEPPER_AUTO_FEED_VALUE "6af"
34#define EPROM_STEPPER_JACKPOT_FEED_VALUE "7jf"
36#define EPROM_STEPPER_KIND_VALUE "8sk"
38#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE "9jp"
40#define EPROM_SENSOR_TILT_VALUE "TILT_10"
42#define EPROM_SENSOR_PIR_VALUE "11pr"
44#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE "12sz"
47#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE "13bk"
49#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE "14to"
51#define EPROM_HIGH_TEMP_POWEROFF_VALUE "15pw"
53#define EPROM_IS_MINIMAL_MENU_SETTING "16mm"
55#define EPROM_STEPPER_ANGLE_FLOAT_SETTING "17sa"
58#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING "18po"
61#define EPROM_WIFI_CREDENTIAL_1_SETTING "19w1"
63#define EPROM_WIFI_CREDENTIAL_2_SETTING "20w2"
66#define EPROM_PAIRED_DEVICE_SETTING "21pd"
69#define EPROM_DEVICE_NAME_SETTING "22dn"
72#define EPROM_FIRST_TIME_FEATURE_SETTING "23fs"
75#define EPROM_ONLY_GEN3_CONNECT_SETTING "23gs"
78#define EPROM_SCREEN_COLOR_SETTING "24sc"
81#define EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING "25bs"
84#define EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING "26bd"
87#define EPROM_USE_DOC_FOLLOW_SETTING "27df"
90#define EPROM_SUB_DAWGPACK_SETTING "28dg"
93#define EPROM_USE_SPIFF_SETTING "29sf"
96#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING "30da"
101#define EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING "31md"
104#define EPROM_SENDWIFI_WITH_BLE "32wb"
107#define EPROM_NOTIFY_BLE_DISCOVERY "33bd"
110#define EPROM_PREFERENCE_TIMER_INT_SETTING "34tm"
113#include <Preferences.h>
115#define PREFERENCES_EPROM_MAIN_NAME "MainPrefs"
142 SerialLots.printf(
"savePreference .. %d, %s\n", preferenceID, preferenceValue);
165 sprintf(str,
"%d",val);
213 SerialLots.print(
" CACHE preference = ");
214 SerialLots.printf(
" [%d] = ",preferenceID);
215 SerialLots.println(valBool);
220 SerialLots.print(
" preference = ");
221 SerialLots.printf(
" [%d] = ",preferenceID);
222 SerialLots.println(val);
223 valBool = (strcmp(val,
"1")==0)?
true:
false;
236 SerialLots.print(
" set CACHE preference");
237 SerialLots.printf(
" [%d] = ",preferenceID);
238 SerialLots.println(flag);
272 float fval = atof(val);
287 SerialTemp.println(
"setOnBootPreferences_mainModule");
320 String preferenceValue;
321 int preferenceID = i;
323 if (preferenceValue && preferenceValue.length() > 0)
334 SerialTemp.println(preferenceValue);
422#ifdef ESP_32_FEEDER_BLE_GEN3
620 SerialError.printf(
" ** NO default for preference[%d]\n", i);
629#ifdef SERIAL_DEBUG_TEMP
630 SerialTemp.println(
"******************");
631 SerialTemp.println(VERSION);
677 SerialLots.println(
"Clean EPROM.. ");
688 SerialTemp.println(
"Setting _DiscoverM5PTClicker");
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
void main_dispatchAsyncCommand(int asyncCallCommand)
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
#define NO_POWEROFF_AMOUNT_STRING_MAIN
#define ASYNC_CALL_CLEAN_EPROM
cleans the EPROM totally, and reboots
#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