2#include "../../Defines.h"
16#define NUMBER_GROUPS 4
17#define STRING_MAX_SIZE 40
29#define EPROM_MAIN_GATEWAY_VALUE "1gt"
31#define EPROM_MAIN_BLE_SERVER_VALUE "2bs"
33#define EPROM_MAIN_BLE_CLIENT_VALUE "3bc"
36#define EPROM_STEPPER_BUZZER_VALUE "4bz"
38#define EPROM_STEPPER_SINGLE_FEED_VALUE "5sf"
40#define EPROM_STEPPER_AUTO_FEED_VALUE "6af"
42#define EPROM_STEPPER_JACKPOT_FEED_VALUE "7jf"
44#define EPROM_STEPPER_KIND_VALUE "8sk"
46#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE "9jp"
48#define EPROM_SENSOR_TILT_VALUE "TILT_10"
50#define EPROM_SENSOR_PIR_VALUE "11pr"
52#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE "12sz"
55#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE "13bk"
57#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE "14to"
59#define EPROM_HIGH_TEMP_POWEROFF_VALUE "15pw"
61#define EPROM_IS_MINIMAL_MENU_SETTING "16mm"
63#define EPROM_STEPPER_ANGLE_FLOAT_SETTING "17sa"
66#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING "18po"
69#define EPROM_WIFI_CREDENTIAL_1_SETTING "19w1"
71#define EPROM_WIFI_CREDENTIAL_2_SETTING "20w2"
74#define EPROM_PAIRED_DEVICE_SETTING "21pd"
77#define EPROM_DEVICE_NAME_SETTING "22dn"
80#define EPROM_FIRST_TIME_FEATURE_SETTING "23fs"
83#define EPROM_ONLY_GEN3_CONNECT_SETTING "23gs"
86#define EPROM_SCREEN_COLOR_SETTING "24sc"
89#define EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING "25bs"
92#define EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING "26bd"
95#define EPROM_USE_DOC_FOLLOW_SETTING "27df"
98#define EPROM_SUB_DAWGPACK_SETTING "28dg"
101#define EPROM_USE_SPIFF_SETTING "29sf"
104#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING "30da"
109#define EPROM_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING "31md"
112#define EPROM_SENDWIFI_WITH_BLE "32wb"
115#define EPROM_NOTIFY_BLE_DISCOVERY "33bd"
118#define EPROM_PREFERENCE_TIMER_INT_SETTING "34tm"
121#define EPROM_PREFERENCE_SUPPORT_GROUPS_SETTING "35g"
124#define EPROM_PREFERENCE_GROUP_NAMES_SETTING "36g"
127#define EPROM_PREFERENCE_DEBUG_INFO_SETTING "37db"
131#define EPROM_DEV_ONLY_SM_SETTING "38dsm"
134#define EPROM_PREFERENCE_TIMER_MAX_INT_SETTING "39x"
137#define EPROM_PREFERENCE_ATOMS_SETTING "40a"
140#define EPROM_PREFERENCE_ATOM_KIND_SETTING "41Atom"
143#define EPROM_PREFERENCE_SM_ON_PIR_SETTING "42pir"
145#define EPROM_PREFERENCE_SM_COMMAND_PIR_SETTING "43pir"
147#define EPROM_PREFERENCE_SM_COMMAND_PIR_OFF_SETTING "44pir"
149#define EPROM_PREFERENCE_ATOM_SOCKET_GLOBAL_ONOFF_SETTING "45sock"
152#define EPROM_USE_SPIFF_MQTT_SETTING "46spiff"
154#define EPROM_USE_SPIFF_QRATOM_SETTING "47spiff"
160#define EPROM_STEPPER_AUTO_MOTOR_DIRECTION_SETTING "48a"
163#define EPROM_INCLUDE_GROUP_NAMES_SETTING "49e"
168#define EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING "50sf"
173#define EPROM_SENSOR_PLUGS_SETTING "51sp"
178#define EPROM_SENSORS_SETTING "52sensors"
183#define EPROM_STEPPER_RPM_SETTING "53sRPM"
187#define EPROM_STEPPER_2FEED_SETTING "542feed"
192#define EPROM_CHAIN_SENSORS_SETTING "6Chain5snsors"
196#include <Preferences.h>
198#define PREFERENCES_EPROM_MAIN_NAME "MainPrefs"
233 boolean found =
false;
236 char *topicName = rindex(topic,
'/');
244 if (group && strlen(group) == 0)
253 SerialTemp.printf(
"compare: %s to %s\n", topicName, group);
254 if (strcmp(topicName, group) == 0)
265 SerialTemp.printf(
"topicInIncludeGroup(%s) =%d\n", topicName, found);
272 SerialTemp.printf(
"parseIncludeGroups %s\n", groups);
285 if (!index(groups,
','))
297 for (token = strtok_r(str,
",",&rest); token != NULL; token = strtok_r(NULL,
",", &rest))
322 SerialTemp.printf(
"savePreference .. %d = '%s'\n", preferenceID, preferenceValue.c_str());
336#define MAX_APPEND 1500
355 SerialDebug.println(
" *** preference > max, emptying .. ");
397 sprintf(str,
"%d",val);
430 SerialLots.printf(
"getPreference_mainModule[%d] = %s\n", preferenceID,
_preferenceBuffer);
448 SerialLots.print(
" CACHE preference = ");
449 SerialLots.printf(
" [%d] = ",preferenceID);
450 SerialLots.println(valBool);
457 SerialLots.print(
" preference = ");
458 SerialLots.printf(
" [%d] = ",preferenceID);
459 SerialLots.println(val);
461 valBool = (strcmp(val,
"1")==0)?
true:
false;
474 SerialLots.print(
" set CACHE preference");
475 SerialLots.printf(
" [%d] = ",preferenceID);
476 SerialLots.println(flag);
512 float fval = atof(val);
520 sprintf(str,
"%2f",val);
536 SerialTemp.println(
"setOnBootPreferences_mainModule");
571 String preferenceValue;
572 int preferenceID = i;
575 if (preferenceValue && preferenceValue.length() > 0)
587 SerialLots.println(preferenceValue);
635#ifdef TODO_THIS_CACHE
670 SerialDebug.println(
"***initPreferencesMainModule");
694#ifdef ATOM_QRCODE_MODULE
715#ifdef ATOM_SOCKET_MODULE
741#ifdef ESP_32_FEEDER_BLE_GEN3
866#ifdef ESP_M5_ATOM_LITE
1056#ifdef USE_SPIFF_MQTT_SETTING
1064#ifdef USE_SPIFF_QRATOM_SETTING
1130 SerialLots.println(
" ** setting PREFERENCE_STEPPER_2FEED_SETTING = 0");
1135 SerialError.printf(
" ** NO default for preference[%d]\n", i);
1144void resetSensorToDefault_mainModule()
1156#ifdef SERIAL_DEBUG_TEMP
1157 SerialTemp.println(
"******************");
1158 SerialTemp.println(VERSION);
1164 SerialTemp.printf(
"CONNECTED_BLE_DEVICE: %s\n", BLEDeviceName);
1250#ifdef M5CORE2_MODULE
1251 SerialTemp.printf(
"PREFERENCE_M5Core2_SETTING:\n");
1253#if (SERIAL_DEBUG_CALL)
1270 SerialTemp.println(
" *** Example JSON messages you can modify and paste into serial monitor, no DEV required");
1273 SerialTemp.printf(
"{\"set\":\"sensors\",\"val\":\"%s\"}", (
char*)
"BuzzerSensorClass,19,22,L9110S_DCStepperClass,21,25");
1274 SerialTemp.println();
1277 SerialTemp.printf(
"{\"set\":\"sensors\",\"val\":\"%s\"}", (
char*)
"PIRSensorClass,23,33");
1278 SerialTemp.println();
1279 SerialTemp.printf(
"{\"set\":\"sensorPlugs\",\"val\":\"L9110S_DCStepperClass\"}");
1280 SerialTemp.println();
1281 SerialTemp.printf(
"{\"set\":\"M5AtomKind\",\"val\":\"M5HDriver\"}");
1282 SerialTemp.println();
1289 SerialTemp.printf(
"{\"set\":\"stepperAngle\",\"val\":\"150\"} --new Feeder");
1290 SerialTemp.println();
1293 SerialDebug.println(
"{\"ssid\":\"Bob\", \"ssidPassword\":\"scott\"}");
1294 SerialDebug.println(
"{\"set\":\"2feed\", \"val\":\"1\"}");
1295 SerialDebug.println(
"{\"set\":\"BLEUseDeviceName\", \"val\":\"off\"}");
1300 SerialTemp.printf(
" *** PIN USE (%d) .. check for duplicated done next .. look for 'ERROR' \n", pinUseStruct->
pinUseCount);
1306 SerialTemp.printf(
" *** PIN Count = %d\n", pinUseStruct->
pinUseCount);
1312 boolean duplicatePins =
false;
1314 for (
int i = 0; i < count - 1; i++)
1316 for (
int j = i + 1; j < count; j++)
1323 duplicatePins =
true;
1324 SerialDebug.printf(
"*** ERROR: DUPLICATE PIN: %d, (%s) == (%s)\n",pin1, pinUseStruct->
pinUseArray[i], pinUseStruct->
pinUseArray[j]);
1339 SerialLots.println(
"Clean EPROM.. ");
1350 SerialTemp.println(
"Setting _DiscoverM5PTClicker");
1371 SerialDebug.printf(
"M5AtomKind = %s\n", value.c_str());
1405 if (strcasecmp(atomKind,
"M5AtomScanner")==0)
1409 else if (strcasecmp(atomKind,
"M5AtomSocket")==0)
1418#define NEW_SENSORS_PREFERENCE
1441 SerialDebug.printf(
"SENSOR: %s,%d,%d\n", sensor->
sensorName, sensor->
pin1, sensor->
pin2);
1443 SerialDebug.printf(
"SENSOR: **** Null sensor ***\n");
1450 int count = sensors->
count;
1451 SerialDebug.printf(
"DEFINED_SENSORS SensorClassType (%ld):\n", count);
1452 SerialDebug.printf(
" ******** \n");
1453 for (
int i=0; i< count; i++)
1457 SerialDebug.printf(
" ******** \n");
1472 SerialDebug.println(
" **** sensorsStructs_mainModule NULL ****");
1477 for (
int i=0; i< count; i++)
1499 SerialDebug.printf(
"setSensorsString_mainModule(%s)\n", sensorsString);
1501 if (!sensorsString || strlen(sensorsString)==0)
1522 SerialDebug.println(
"**** initSensorStringsFromEPROM_mainModule ****");
1534 char *copy = strdup(str);
1554 SerialDebug.printf(
"*** parseSensorString_mainModule: %s\n", sensorsString);
1556 if (!sensorsString || strlen(sensorsString)==0)
1558 SerialDebug.println(
"parseSensorString_mainModule: *** No Sensors or string **");
1569 strcpy(str,sensorsString);
1570 strcpy(strCopy,sensorsString);
1579 for (
int whichPass = 0; whichPass<2; whichPass++)
1581#define secondPass (whichPass == 1)
1586 numSensors = arrayIndex / max;
1587 strcpy(str,strCopy);
1588 SerialDebug.printf(
" ** Create sensors %d\n", numSensors);
1598 for (
char *token= strtok(str,
","); token!= NULL; token= strtok(NULL,
","))
1600 int indexInSensor = arrayIndex / max;
1601 int indexInArray = arrayIndex % max;
1605 switch (indexInArray)
1624 int pin = atoi(token);
1625 if (pin == 16 || pin == 17)
1628 SerialDebug.printf(
"*** BAD PIN: %d, setting to 22 ***\n", pin);
1632 sensorItems[indexInSensor].
pin1= pin;
1640 int pin = atoi(token);
1641 if (pin == 16 || pin == 17)
1643 SerialDebug.printf(
"*** BAD PIN: %d, setting to 22 ***\n", pin);
1647 sensorItems[indexInSensor].
pin2= pin;
1658 sensors->
count = numSensors;
1659 sensors->
sensors = sensorItems;
1661 SerialDebug.printf(
"parseSensorString_mainModule: ** sensors->count = %ld\n", sensors->
count);
1667#pragma mark CHAIN_STRUCT
1674 int buttonNumberArray[PIN_USE_MAX];
1676 char *setStringArray[PIN_USE_MAX];
1678 char *valStringArray[PIN_USE_MAX];
1680 char *deviceStringArray[PIN_USE_MAX];
1703 SerialDebug.printf(
"*** parseChainSensorString_mainModule: %s\n", chainUseString);
1714 return chainUseStruct;
1723 SerialDebug.printf(
"*** parseChainSensorString_mainModule: %s\n", chainUseString);
1730 if (!chainUseString || strlen(chainUseString)==0)
1732 SerialDebug.println(
"parseSensorString_mainModule: *** No chainUseString or string **");
1733 return chainUseStruct;
1741#define MAX_CHAIN_STRING 300
1746 SerialDebug.printf(
"ChainUseString length too big %d\n", strlen(chainUseString));
1749 strcpy(str,chainUseString);
1750 strcpy(strCopy,chainUseString);
1756 int numChainStructs;
1763 for (
int whichPass = 0; whichPass<2; whichPass++)
1765#define secondPass (whichPass == 1)
1772 numChainStructs = arrayIndex / max;
1773 strcpy(str,strCopy);
1774 SerialDebug.printf(
" ** Create sensors %d\n", numChainStructs);
1786 for (
char *token= strtok(str,
","); token!= NULL; token= strtok(NULL,
","))
1788 int indexInSensor = arrayIndex / max;
1789 int indexInArray = arrayIndex % max;
1790 SerialDebug.printf(
"%d Token[%d] = %s\n",indexInArray, indexInSensor, token);
1802 switch (indexInArray)
1812 int num = atoi(token);
1818 int num = atoi(token);
1819 chainButtonStructs[indexInSensor].
pressKind = num;
1833 char chainUseSample[200];
1834 sprintf(chainUseSample,
"CHAIN_USE: %s press=%d btn=%2d set= %s, val=%s dev=%s",chainButtonStructs[indexInSensor].classType, chainButtonStructs[indexInSensor].pressKind, chainButtonStructs[indexInSensor].buttonNumber, chainButtonStructs[indexInSensor].setString, chainButtonStructs[indexInSensor].valString, chainButtonStructs[indexInSensor].deviceString);
1849 SerialDebug.printf(
"parseSensorString_mainModule: ** sensors->count = %ld\n", numChainStructs);
1851 return chainUseStruct;
1861 strcpy(str,
"BC,1,1,feed, ,$localhost, BC,1,2,feed, , , BC,2,2,SM_Matrix,6,$dev, BC,2,3, togglesocket, ,M5AtomSocket");
1867 SerialDebug.println(
"DONE testParse");
1880 SerialDebug.printf(
"initSensors:initChainSensorStringsFromEPROM_mainModule = '%s'\n",
_chainSensorsEPROM);
1922 SerialDebug.println(
"done register chain buttons");
1940 SerialDebug.printf(
"setChainSensorsString_mainModule(%s)\n", chainSensorsString);
1942 if (!chainSensorsString || strlen(chainSensorsString)==0)
1966 else if (strlen(str) == 0)
1977 for (
int lap = 0; lap < 2; lap++)
1979 boolean showAsEPROM = (lap == 0);
1990 SerialDebug.printf(
",");
1991 SerialDebug.printf(
"%s,%d,%d,%s,%s,%s", chainButtonStruct->
classType, chainButtonStruct->
buttonNumber, chainButtonStruct->
pressKind,
non0string(chainButtonStruct->
setString),
non0string(chainButtonStruct->
valString),
non0string(chainButtonStruct->
deviceString));
1994 SerialDebug.printf(
"%d -> %s\n", i, chainButtonStruct->
chainUse?chainButtonStruct->
chainUse:(
char*)
"NULL");
1997 SerialDebug.println();
2021void registerChain_mainModule(String classType,
int buttonNumber,
int pressKind, String setString, String valString, String deviceString)
2026 SerialError.printf(
"*** ERROR .. too many CHAINS defined ***");
2030 char chainUseSample[100];
2031 sprintf(chainUseSample,
"CHAIN_USE: %s btn=%2d press=%d set= %s, val=%s dev=%s",classType, buttonNumber,pressKind, setString.c_str(), valString.c_str(), deviceString.c_str());
2032 SerialDebug.println(chainUseSample);
2044 char *chainUse = (
char*)calloc(strlen(chainUseSample)+1,
sizeof(char));
2045 strcpy(chainUse, chainUseSample);
2049 chainbuttonStruct->
chainUse = chainUse;
2058 chainbuttonStruct->
pressKind = pressKind;
2085 SerialDebug.printf(
"getChainUseStruct(%d, %d)\n", buttonNumber_1based, pressKind);
2097 if (chainButtonStruct->
buttonNumber == buttonNumber_1based)
2099 SerialDebug.printf(
"chainButton (%d, press=%d) = %s\n", buttonNumber_1based, chainButtonStruct->
pressKind, chainButtonStruct->
chainUse);
2103 SerialDebug.printf(
"matched button %ld, press=%ld \n", buttonNumber_1based, pressKind);
2106 return chainButtonStruct;
2124 SerialDebug.printf(
"processChainUseStruct: %s, %s\n", chainUseStruct->
setString, chainUseStruct->
valString);
2126 boolean isLocalHost =
false;
2127 boolean useCurrentDevice =
false;
2128 boolean nullValString =
false;
2130 nullValString =
true;
2131 if (deviceName && strlen(deviceName) > 0)
2134 switch (deviceName[0])
2139 if ( strcmp(deviceName,
"$localhost")==0)
2141 else if (strcmp(deviceName,
"$dev")==0)
2142 useCurrentDevice =
true;
2151 if (isLocalHost && strcmp(chainUseStruct->
setString,
"feed")==0)
void sendMessageNoChangeMQTT(char *message)
just send a message but without any extras
char * createCopy2(const char *stringA)
char * main_getUsername()
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
char * main_getPassword()
return password
char * getServerServiceName_mainModule()
void main_dispatchAsyncCommand(int asyncCallCommand)
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
PinUseStruct * getPinUseStruct_mainModule()
get the pin use array
char * getChipIdString()
3.17.24 get the chip id as a string
char * connectedBLEDeviceName_mainModule()
returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name,...
#define ASYNC_SEND_MQTT_FEED_MESSAGE
sends a message (like FEED) on the users topic
#define NO_POWEROFF_AMOUNT_STRING_MAIN
#define ASYNC_CALL_CLEAN_EPROM
cleans the EPROM totally, and reboots
#define EPROM_DEV_ONLY_SM_SETTING
9.28.23 #272 only show Semantic Markers that are sent directly to the device
#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_PREFERENCE_SUPPORT_GROUPS_SETTING
the preference for supporting GROUPS (default true)
#define EPROM_PAIRED_DEVICE_SETTING
the guest device paired with this M5 device (or NONE)
void savePreferenceATOMKind_MainModule(String value)
returned from mainModule
#define EPROM_PREFERENCE_TIMER_MAX_INT_SETTING
11.29.23 add the max time .. so a random can be used
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....
#define EPROM_PREFERENCE_ATOM_KIND_SETTING
1.4.24 What kind of ATOM plug (set, M5AtomKind, val= {M5AtomSocket, M5AtomScanner}
void printSensors_mainModule(SensorsStruct *sensors)
print sensors, passing in a struct
#define EPROM_PREFERENCE_SM_COMMAND_PIR_SETTING
1.10.24 The Semantic Marker command is sent on PIR, and the Command to send
SensorsStruct * getSensors_mainModule()
return the sensors defined
#define EPROM_PREFERENCE_SM_COMMAND_PIR_OFF_SETTING
1.11.24 The Semantic Marker command is sent on PIR, and the Command to send
char _includeGroupsStringArray[NUMBER_GROUPS][STRING_MAX_SIZE]
resulting group names
char * _preferenceMainModuleLookupEPROMNames[MAX_MAIN_PREFERENCES]
array of preference names (those used in process()
#define EPROM_PREFERENCE_ATOMS_SETTING
1.1.24 the preference for all the ATOM plugs (format: atomType:value} .. for now just use socket:on
void initChainSensorStringsFromEPROM_mainModule()
void appendPreference_mainModule(int preferenceID, String preferenceValue)
called to append to a a preference (which will be an identifier and a string, which can be converted ...
#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING
9.3.22 eprom of the Address of desired BLE
ChainUseStruct * parseChainSensorString_mainModuleNEW(char *chainUseString)
void setDiscoverM5PTClicker(boolean flag)
#define EPROM_SENDWIFI_WITH_BLE
send WIFI to all except our device (and our paired) when
void setSensorsString_mainModule(char *sensorsString)
#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).
String _appendingPreferenceString
storage for the appending string
void resetAllPreferences_mainModule()
resets preferences.. Currently only reset all, but eventually reset(groups..)
void testParse()
just try parsing for now..
#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
ChainUseStruct * getChainUseStruct_mainModule()
get the pin use array
#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...
#define EPROM_PREFERENCE_SM_ON_PIR_SETTING
1.10.24 Flag on whether a Semantic Marker command is sent on PIR, and the Command to send
void registerChain_mainModule(String classType, int buttonNumber, int pressKind, String setString, String valString, String deviceString)
void togglePreferenceBoolean_mainModule(int preferenceID)
toggles a preference boolean
#define EPROM_USE_SPIFF_SETTING
8.22.22 to turn on/off SPIFF use
void printSensor_mainModule(SensorStruct *sensor)
print sensor
#define EPROM_PREFERENCE_DEBUG_INFO_SETTING
a place to put some kind of Last Will of what went wrong .. for now (> max tries)
#define EPROM_SCREEN_COLOR_SETTING
color of the M5 screen
void resetPreference_mainModule(int preferenceID)
called to reset to blank a preference (which will be an identifier and a string, which can be convert...
#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..
void storePreference_mainModule(int preferenceID, String preferenceValue)
called to append to a a preference (which will be an identifier and a string, which can be converted ...
void initAppendingPreference_mainModule(int preferenceID)
called to init the preference. This won't save anything until storePreference called
char * getPreferenceATOMKind_MainModule()
new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner)
#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE
ChainButtonStruct * getChainUseStruct(int buttonNumber_1based, int pressKind)
#define EPROM_PREFERENCE_ATOM_SOCKET_GLOBAL_ONOFF_SETTING
1.12.24 Whether the AtomSocket accepts global on/off messages
void savePreferenceFloat_mainModule(int preferenceID, float val)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void printChainSensors_mainModule(ChainUseStruct *chainUseStruct)
print sensors, passing in a struct
#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
#define EPROM_USE_SPIFF_MQTT_SETTING
4.4.24 for MQTT use of spiff (or not)
#define EPROM_STEPPER_AUTO_MOTOR_DIRECTION_SETTING
#define EPROM_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define EPROM_INCLUDE_GROUP_NAMES_SETTING
include these topics groups..
void setOnBootPreferences_mainModule()
set some defaults on boot - that override EPROM this can be called on the HOME screen to set back to ...
#define EPROM_STEPPER_RPM_SETTING
SensorsStruct * parseSensorString_mainModule(char *str)
return array of SensorsStruct after parsing string syntax: {SENSOR,pin1,pin2}
char * non0string(char *str)
return a non 0 length string
void initSensorStringsFromEPROM_mainModule()
ChainUseStruct * _chainUseStruct
global for use. This is an object (not a pointer) and has all the storage created statically
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_USE_SPIFF_QRATOM_SETTING
4.4.24 for QRATOM use of spiff (or not)
void parseIncludeGroups(char *groups)
8.2.24 set the include group (and cache it), called (indirectly from MQTT via setIncludeGroups
void resetChainSensorToDefault_mainModule()
1.27.26
#define EPROM_SENSOR_TILT_VALUE
sensor preferences for tilt on or off
#define MAX_APPEND
special preference string for saving and printing back later..
boolean topicInIncludeGroup(char *topic)
char * copyString_mainModule(char *str)
copy string
void setChainSensorsString_mainModule(char *chainSensorsString)
SensorsStruct * _sensorsStructs_mainModule
array of sensorStruct
#define EPROM_STEPPER_KIND_VALUE
the step kind
#define EPROM_HIGH_TEMP_POWEROFF_VALUE
sets the max temp for a poweroff
int getM5ATOMKind_MainModule()
new 1.4.24 setting ATOM kind (eg. ATOM_KIND_M5_SCANNER, ATOM_KIND_M5_SOCKET)
#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
ChainUseStruct * parseChainSensorString_mainModule(char *chainUseString)
#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..
boolean _firstTimeAtomKind
if the preference was retrieved..
char _mqttMessage_ChainButton[100]
#define EPROM_SENSORS_SETTING
#define EPROM_PREFERENCE_GROUP_NAMES_SETTING
the preference setting group names to subscribe (but empty or # go to wildcard, this also supports wi...
char * getPreference_mainModule(int preferenceID)
#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE
display preferences zoomed or not zoomed
SensorStruct * getSensor_mainModule(char *sensorName)
return the sensor specified or null
void setIncludeGroups(char *groups)
8.2.24 set the include group (and cache it), called from MQTT
boolean _DiscoverM5PTClicker
#define EPROM_STEPPER_2FEED_SETTING
void readAppendingPreference_mainModule(int preferenceID)
called to init the preference. This won't save anything until storePreference called
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
char _chainSensorsEPROM[500]
boolean _isCachedPreferenceInt[MAX_MAIN_PREFERENCES]
array of boolean if the ID is cached..
#define EPROM_SENSOR_PLUGS_SETTING
#define EPROM_CHAIN_SENSORS_SETTING
void processChainUseStruct(ChainButtonStruct *chainUseStruct)
void initPreferencesMainModule()
initialize the _preferencesMainLookup with EPROM lookup names
char _sensorsEPROM[500]
the memory for the sensorsEPROM
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 (more below..)
#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 BUTTON_JOYSTICK_BOTTOM
#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_SM_COMMAND_PIR_OFF_SETTING
1.11.24 The Semantic Marker command is sent on PIR, and the Command to send on OFF (or opposite)
#define PREFERENCE_SENSOR_PLUGS_SETTING
#define PREFERENCE_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define ATOM_KIND_M5_SCANNER
returned from mainModule
#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_SUPPORT_GROUPS_SETTING
the preference for supporting GROUPS (default true)
#define PREFERENCE_INCLUDE_GROUP_NAMES_SETTING
8.2.24 don't change subscription but include these groups (eg. safeHouse,atlasDogs)
#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE
Display preferences (SemanticMarker etc) - boolean.
#define PREFERENCE_STEPPER_JACKPOT_FEED_VALUE
#define BUTTON_JOYSTICK_LEFT
map x,y to quadrants
#define PREFERENCE_WIFI_CREDENTIAL_2_SETTING
#define ATOM_KIND_M5_SOCKET
#define PREFERENCE_STEPPER_RPM_SETTING
#define PREFERENCE_MAIN_BLE_SERVER_VALUE
#define BUTTON_DOUBLE_PRESS
#define PREFERENCE_PAIRED_DEVICE_SETTING
the paired device for guest device feeding (6.6.22)
#define PREFERENCE_STEPPER_BUZZER_VALUE
stepper preferences
#define PREFERENCE_DEV_ONLY_SM_SETTING
adding AP_DEBUG_MODE to let others know that DEBUG eprom is available. Turn this OFF for non dev
#define MAX_MAIN_PREFERENCES
******* 1 greater than last value **** IMPORTANT *** and no gaps..
#define PREFERENCE_ATOMS_SETTING
1.1.24 the preference for all the ATOM plugs (format: atomType:value} .. for now just use socket:on
#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING
#define BUTTON_JOYSTICK_RIGHT
#define PREFERENCE_USE_DOC_FOLLOW_SETTING
for
#define PREFERENCE_WIFI_CREDENTIAL_1_SETTING
#define PREFERENCE_ATOM_SOCKET_GLOBAL_ONOFF_SETTING
1.12.24 Whether the AtomSocket accepts global on/off messages
#define PREFERENCE_USE_SPIFF_MQTT_SETTING
#define PREFERENCE_DEBUG_INFO_SETTING
a place to put some kind of Last Will of what went wrong .. for now (> max tries)
#define PREFERENCE_CHAIN_SENSORS_SETTING
#define BUTTON_SHORT_PRESS
#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_USE_SPIFF_QRATOM_SETTING
For MQTT writing to the QRATOM.
#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_GROUP_NAMES_SETTING
the preference setting group names to subscribe (but empty or # go to wildcard, this also supports wi...
#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING
#define BUTTON_LONG_PRESS
#define PREFERENCE_STEPPER_2FEED_SETTING
#define PREFERENCE_STEPPER_AUTO_MOTOR_DIRECTION_SETTING
#define PREFERENCE_TIMER_MAX_INT_SETTING
the preference timer MAX (pairs with PREFERENCE_TIMER_INT_SETTING)
#define PREFERENCE_MAIN_GATEWAY_VALUE
#define BUTTON_JOYSTICK_TOP
#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define PREFERENCE_MAIN_BLE_CLIENT_VALUE
#define PREFERENCE_SM_ON_PIR_SETTING
1.10.24 Flag on whether a Semantic Marker command is sent on PIR, and the Command to send
#define PREFERENCE_TIMER_INT_SETTING
the preference timer
#define PREFERENCE_ATOM_KIND_SETTING
1.4.24 What kind of ATOM plug (set, M5AtomKind, val= {M5AtomSocket, M5AtomScanner}
#define PREFERENCE_SM_COMMAND_PIR_SETTING
1.10.24 The Semantic Marker command is sent on PIR, and the Command to send
#define PREFERENCE_SENSORS_SETTING
#define PREFERENCE_STEPPER_AUTO_FEED_VALUE
ChainButtonStruct * chainButtonStructArray
1.22.26 define a Chainbutton and creates N of them
int chainUseCount
number of chain
long pinNumArray[PIN_USE_MAX]
each pin
char * pinUseArray[PIN_USE_MAX]
string describing the module, etc
SensorClassType * sensorClassType
and the pointer to matching SensorClassType
SensorStruct * sensors
array of sensorStruct