ESP_IOT v2.5
IOT ESP Coding
PreferencesController.cpp File Reference
#include "../../Defines.h"
#include "PreferencesController.h"
#include <Preferences.h>
Include dependency graph for PreferencesController.cpp:

Go to the source code of this file.

Macros

#define NUMBER_GROUPS   4
 
#define STRING_MAX_SIZE   40
 
#define EPROM_MAIN_GATEWAY_VALUE   "1gt"
 
#define EPROM_MAIN_BLE_SERVER_VALUE   "2bs"
 BLEServer mode. More...
 
#define EPROM_MAIN_BLE_CLIENT_VALUE   "3bc"
 BLEClient mode. More...
 
#define EPROM_STEPPER_BUZZER_VALUE   "4bz"
 buzzer on or off More...
 
#define EPROM_STEPPER_SINGLE_FEED_VALUE   "5sf"
 single feed mode More...
 
#define EPROM_STEPPER_AUTO_FEED_VALUE   "6af"
 auto feed More...
 
#define EPROM_STEPPER_JACKPOT_FEED_VALUE   "7jf"
 jackpot feed More...
 
#define EPROM_STEPPER_KIND_VALUE   "8sk"
 the step kind More...
 
#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE   "9jp"
 
#define EPROM_SENSOR_TILT_VALUE   "TILT_10"
 sensor preferences for tilt on or off More...
 
#define EPROM_SENSOR_PIR_VALUE   "11pr"
 proximity PIR More...
 
#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE   "12sz"
 display preferences zoomed or not zoomed More...
 
#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE   "13bk"
 Display preferences - show messages on blank screen- boolean. More...
 
#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE   "14to"
 sets the timeout value More...
 
#define EPROM_HIGH_TEMP_POWEROFF_VALUE   "15pw"
 sets the max temp for a poweroff More...
 
#define EPROM_IS_MINIMAL_MENU_SETTING   "16mm"
 whether to show the minimal or expanded menu More...
 
#define EPROM_STEPPER_ANGLE_FLOAT_SETTING   "17sa"
 sets stepper angle, a floating point number More...
 
#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING   "18po"
 sets screentimeout if not button clicks (set,noclick,val,seconds) More...
 
#define EPROM_WIFI_CREDENTIAL_1_SETTING   "19w1"
 for now, save 2 WIFI Credentials More...
 
#define EPROM_WIFI_CREDENTIAL_2_SETTING   "20w2"
 second wifi credential More...
 
#define EPROM_PAIRED_DEVICE_SETTING   "21pd"
 the guest device paired with this M5 device (or NONE) More...
 
#define EPROM_DEVICE_NAME_SETTING   "22dn"
 the device name More...
 
#define EPROM_FIRST_TIME_FEATURE_SETTING   "23fs"
 a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE More...
 
#define EPROM_ONLY_GEN3_CONNECT_SETTING   "23gs"
 if true, only BLEClient connect to GEN3 feeders.. More...
 
#define EPROM_SCREEN_COLOR_SETTING   "24sc"
 color of the M5 screen More...
 
#define EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING   "25bs"
 if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined). More...
 
#define EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING   "26bd"
 
#define EPROM_USE_DOC_FOLLOW_SETTING   "27df"
 NOTE: these EPROM have to be lockstep the same as the PREFERENCE definitions in MainModule.h. More...
 
#define EPROM_SUB_DAWGPACK_SETTING   "28dg"
 8.17.22 to turn on/off subscribing to the dawgpack topic More...
 
#define EPROM_USE_SPIFF_SETTING   "29sf"
 8.22.22 to turn on/off SPIFF use More...
 
#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING   "30da"
 9.3.22 eprom of the Address of desired BLE More...
 
#define EPROM_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING   "31md"
 
#define EPROM_SENDWIFI_WITH_BLE   "32wb"
 send WIFI to all except our device (and our paired) when More...
 
#define EPROM_NOTIFY_BLE_DISCOVERY   "33bd"
 starts the BLE Discovery notification process - which might be internal or externa (via messages). More...
 
#define EPROM_PREFERENCE_TIMER_INT_SETTING   "34tm"
 the preference timer More...
 
#define EPROM_PREFERENCE_SUPPORT_GROUPS_SETTING   "35g"
 the preference for supporting GROUPS (default true) More...
 
#define EPROM_PREFERENCE_GROUP_NAMES_SETTING   "36g"
 the preference setting group names to subscribe (but empty or # go to wildcard, this also supports wildcard in the future) More...
 
#define EPROM_PREFERENCE_DEBUG_INFO_SETTING   "37db"
 a place to put some kind of Last Will of what went wrong .. for now (> max tries) More...
 
#define EPROM_DEV_ONLY_SM_SETTING   "38dsm"
 9.28.23 #272 only show Semantic Markers that are sent directly to the device More...
 
#define EPROM_PREFERENCE_TIMER_MAX_INT_SETTING   "39x"
 11.29.23 add the max time .. so a random can be used More...
 
#define EPROM_PREFERENCE_ATOMS_SETTING   "40a"
 1.1.24 the preference for all the ATOM plugs (format: atomType:value} .. for now just use socket:on More...
 
#define EPROM_PREFERENCE_ATOM_KIND_SETTING   "41Atom"
 1.4.24 What kind of ATOM plug (set, M5AtomKind, val= {M5AtomSocket, M5AtomScanner} More...
 
#define EPROM_PREFERENCE_SM_ON_PIR_SETTING   "42pir"
 1.10.24 Flag on whether a Semantic Marker command is sent on PIR, and the Command to send More...
 
#define EPROM_PREFERENCE_SM_COMMAND_PIR_SETTING   "43pir"
 1.10.24 The Semantic Marker command is sent on PIR, and the Command to send More...
 
#define EPROM_PREFERENCE_SM_COMMAND_PIR_OFF_SETTING   "44pir"
 1.11.24 The Semantic Marker command is sent on PIR, and the Command to send More...
 
#define EPROM_PREFERENCE_ATOM_SOCKET_GLOBAL_ONOFF_SETTING   "45sock"
 1.12.24 Whether the AtomSocket accepts global on/off messages More...
 
#define EPROM_USE_SPIFF_MQTT_SETTING   "46spiff"
 4.4.24 for MQTT use of spiff (or not) More...
 
#define EPROM_USE_SPIFF_QRATOM_SETTING   "47spiff"
 4.4.24 for QRATOM use of spiff (or not) More...
 
#define EPROM_STEPPER_AUTO_MOTOR_DIRECTION_SETTING   "48a"
 
#define EPROM_INCLUDE_GROUP_NAMES_SETTING   "49e"
 include these topics groups.. More...
 
#define EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING   "50sf"
 
#define EPROM_SENSOR_PLUGS_SETTING   "51sp"
 
#define EPROM_SENSORS_SETTING   "52sensors"
 
#define EPROM_STEPPER_RPM_SETTING   "53sRPM"
 
#define EPROM_STEPPER_2FEED_SETTING   "542feed"
 
#define EPROM_CHAIN_SENSORS_SETTING   "6Chain5snsors"
 
#define PREFERENCES_EPROM_MAIN_NAME   "MainPrefs"
 the EPROM is in preferences.h More...
 
#define MAX_APPEND   1500
 special preference string for saving and printing back later.. More...
 
#define NEW_SENSORS_PREFERENCE
 
#define secondPass   (whichPass == 1)
 
#define MAX_CHAIN_STRING   300
 
#define secondPass   (whichPass == 1)
 

Functions

void initPreferencesMainModule ()
 initialize the _preferencesMainLookup with EPROM lookup names More...
 
boolean topicInIncludeGroup (char *topic)
 
void parseIncludeGroups (char *groups)
 8.2.24 set the include group (and cache it), called (indirectly from MQTT via setIncludeGroups More...
 
void setIncludeGroups (char *groups)
 8.2.24 set the include group (and cache it), called from MQTT More...
 
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 number or boolean) More...
 
void readAppendingPreference_mainModule (int preferenceID)
 called to init the preference. This won't save anything until storePreference called More...
 
void initAppendingPreference_mainModule (int preferenceID)
 called to init the preference. This won't save anything until storePreference called More...
 
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 to a number or boolean) More...
 
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 to a number or boolean) More...
 
void resetPreference_mainModule (int preferenceID)
 called to reset to blank a preference (which will be an identifier and a string, which can be converted to a number or boolean) More...
 
void savePreferenceInt_mainModule (int preferenceID, int val)
 sets an int preference More...
 
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 More...
 
void togglePreferenceBoolean_mainModule (int preferenceID)
 toggles a preference boolean More...
 
char * getPreference_mainModule (int preferenceID)
 
boolean getPreferenceBoolean_mainModule (int preferenceID)
 called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) More...
 
void savePreferenceBoolean_mainModule (int preferenceID, boolean flag)
 save a boolean preference More...
 
char * getPreferenceString_mainModule (int preferenceID)
 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 More...
 
int getPreferenceInt_mainModule (int preferenceID)
 called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) More...
 
float getPreferenceFloat_mainModule (int preferenceID)
 called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) More...
 
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 number or boolean) More...
 
void cleanEPROM_mainModule ()
 clean the preferencesMainModule in EPROM More...
 
void setOnBootPreferences_mainModule ()
 set some defaults on boot - that override EPROM this can be called on the HOME screen to set back to normal mode.. More...
 
void readPreferences_mainModule ()
 reads the preferences. Save is everytime the savePreference is called More...
 
void printPreferenceValues_mainModule ()
 print the preferences to SerialDebug More...
 
void resetAllPreferences_mainModule ()
 resets preferences.. Currently only reset all, but eventually reset(groups..) More...
 
void setDiscoverM5PTClicker (boolean flag)
 
boolean getDiscoverM5PTClicker ()
 get option More...
 
void savePreferenceATOMKind_MainModule (String value)
 returned from mainModule More...
 
char * getPreferenceATOMKind_MainModule ()
 new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner) More...
 
int getM5ATOMKind_MainModule ()
 new 1.4.24 setting ATOM kind (eg. ATOM_KIND_M5_SCANNER, ATOM_KIND_M5_SOCKET) More...
 
SensorsStructparseSensorString_mainModule (char *str)
 return array of SensorsStruct after parsing string syntax: {SENSOR,pin1,pin2} More...
 
void printSensor_mainModule (SensorStruct *sensor)
 print sensor More...
 
void printSensors_mainModule (SensorsStruct *sensors)
 print sensors, passing in a struct More...
 
SensorsStructgetSensors_mainModule ()
 return the sensors defined More...
 
SensorStructgetSensor_mainModule (char *sensorName)
 return the sensor specified or null More...
 
void setSensorsString_mainModule (char *sensorsString)
 
void initSensorStringsFromEPROM_mainModule ()
 
char * copyString_mainModule (char *str)
 copy string More...
 
ChainUseStructgetChainUseStruct_mainModule ()
 get the pin use array More...
 
ChainUseStructparseChainSensorString_mainModule (char *chainUseString)
 
ChainUseStructparseChainSensorString_mainModuleNEW (char *chainUseString)
 
void testParse ()
 just try parsing for now.. More...
 
void initChainSensorStringsFromEPROM_mainModule ()
 
void setChainSensorsString_mainModule (char *chainSensorsString)
 
char * non0string (char *str)
 return a non 0 length string More...
 
void printChainSensors_mainModule (ChainUseStruct *chainUseStruct)
 print sensors, passing in a struct More...
 
void resetChainSensorToDefault_mainModule ()
 1.27.26 More...
 
void registerChain_mainModule (String classType, int buttonNumber, int pressKind, String setString, String valString, String deviceString)
 
ChainButtonStructgetChainUseStruct (int buttonNumber_1based, int pressKind)
 
void processChainUseStruct (ChainButtonStruct *chainUseStruct)
 

Variables

char _preferenceBuffer [100]
 PREFERENCES for the main module. More...
 
char _preferenceBufferString [100]
 buffer for the string More...
 
int _includeGroupLen = 0
 
char _includeGroupsStringArray [NUMBER_GROUPS][STRING_MAX_SIZE]
 resulting group names More...
 
Preferences _preferencesMainModule
 preferences for MAIN More...
 
char * _preferenceMainModuleLookupEPROMNames [MAX_MAIN_PREFERENCES]
 array of preference names (those used in process() More...
 
char * _preferenceMainModuleLookupDefaults [MAX_MAIN_PREFERENCES]
 array of default values to store in the EPROM if not defined.. More...
 
boolean _cachedPreferenceBooleanValues [MAX_MAIN_PREFERENCES]
 
boolean _isCachedPreferenceBoolean [MAX_MAIN_PREFERENCES]
 array of boolean if the ID is cached.. More...
 
int _cachedPreferenceIntValues [MAX_MAIN_PREFERENCES]
 another cache for the Int values.. More...
 
boolean _isCachedPreferenceInt [MAX_MAIN_PREFERENCES]
 array of boolean if the ID is cached.. More...
 
String _appendingPreferenceString = ""
 storage for the appending string More...
 
boolean _DiscoverM5PTClicker = false
 
boolean _firstTimeAtomKind = true
 if the preference was retrieved.. More...
 
int _ATOM_KIND = ATOM_KIND_M5_SCANNER
 
char _sensorsEPROM [500]
 the memory for the sensorsEPROM More...
 
SensorsStruct_sensorsStructs_mainModule = NULL
 array of sensorStruct More...
 
ChainUseStruct_chainUseStruct = NULL
 global for use. This is an object (not a pointer) and has all the storage created statically More...
 
char _chainSensorsEPROM [500]
 
char _mqttMessage_ChainButton [100]
 

Macro Definition Documentation

◆ EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING

#define EPROM_BLE_SERVER_USE_DEVICE_NAME_SETTING   "25bs"

if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).

Definition at line 89 of file PreferencesController.cpp.

◆ EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING

#define EPROM_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING   "26bd"

if set, the BLE Client will look for its service base name (PTFeeder or PTClicker), but if that name 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

Definition at line 92 of file PreferencesController.cpp.

◆ EPROM_CHAIN_SENSORS_SETTING

#define EPROM_CHAIN_SENSORS_SETTING   "6Chain5snsors"

12.21.25 Winter Solstice party .. issue #365 Object Oriented Sensors as well define the sensors (not sensorPlugs). MQTT: set:sensor, set:sensors

Definition at line 192 of file PreferencesController.cpp.

◆ EPROM_DEV_ONLY_SM_SETTING

#define EPROM_DEV_ONLY_SM_SETTING   "38dsm"

9.28.23 #272 only show Semantic Markers that are sent directly to the device

Definition at line 131 of file PreferencesController.cpp.

◆ EPROM_DEVICE_NAME_SETTING

#define EPROM_DEVICE_NAME_SETTING   "22dn"

the device name

Definition at line 77 of file PreferencesController.cpp.

◆ EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE

#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE   "13bk"

Display preferences - show messages on blank screen- boolean.

Definition at line 55 of file PreferencesController.cpp.

◆ EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE

#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE   "14to"

sets the timeout value

Definition at line 57 of file PreferencesController.cpp.

◆ EPROM_FIRST_TIME_FEATURE_SETTING

#define EPROM_FIRST_TIME_FEATURE_SETTING   "23fs"

a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE

Definition at line 80 of file PreferencesController.cpp.

◆ EPROM_HIGH_TEMP_POWEROFF_VALUE

#define EPROM_HIGH_TEMP_POWEROFF_VALUE   "15pw"

sets the max temp for a poweroff

Definition at line 59 of file PreferencesController.cpp.

◆ EPROM_INCLUDE_GROUP_NAMES_SETTING

#define EPROM_INCLUDE_GROUP_NAMES_SETTING   "49e"

include these topics groups..

Definition at line 163 of file PreferencesController.cpp.

◆ EPROM_IS_MINIMAL_MENU_SETTING

#define EPROM_IS_MINIMAL_MENU_SETTING   "16mm"

whether to show the minimal or expanded menu

Definition at line 61 of file PreferencesController.cpp.

◆ EPROM_MAIN_BLE_CLIENT_VALUE

#define EPROM_MAIN_BLE_CLIENT_VALUE   "3bc"

BLEClient mode.

Definition at line 33 of file PreferencesController.cpp.

◆ EPROM_MAIN_BLE_SERVER_VALUE

#define EPROM_MAIN_BLE_SERVER_VALUE   "2bs"

BLEServer mode.

Definition at line 31 of file PreferencesController.cpp.

◆ EPROM_MAIN_GATEWAY_VALUE

#define EPROM_MAIN_GATEWAY_VALUE   "1gt"

Issue #103 NOTE: the EPROM space might be limiting: https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/default.csv to 4KB .. https://www.esp32.com/viewtopic.php?t=9136 So we should start limiting our use, and start with these string indexes.. main module preferences gateway is on THESE MUST ALL BE UNIQUE

Definition at line 29 of file PreferencesController.cpp.

◆ EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING

#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING   "18po"

sets screentimeout if not button clicks (set,noclick,val,seconds)

Definition at line 66 of file PreferencesController.cpp.

◆ EPROM_NOTIFY_BLE_DISCOVERY

#define EPROM_NOTIFY_BLE_DISCOVERY   "33bd"

starts the BLE Discovery notification process - which might be internal or externa (via messages).

Definition at line 115 of file PreferencesController.cpp.

◆ EPROM_ONLY_GEN3_CONNECT_SETTING

#define EPROM_ONLY_GEN3_CONNECT_SETTING   "23gs"

if true, only BLEClient connect to GEN3 feeders..

Definition at line 83 of file PreferencesController.cpp.

◆ EPROM_PAIRED_DEVICE_ADDRESS_SETTING

#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING   "30da"

9.3.22 eprom of the Address of desired BLE

Definition at line 104 of file PreferencesController.cpp.

◆ EPROM_PAIRED_DEVICE_SETTING

#define EPROM_PAIRED_DEVICE_SETTING   "21pd"

the guest device paired with this M5 device (or NONE)

Definition at line 74 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_ATOM_KIND_SETTING

#define EPROM_PREFERENCE_ATOM_KIND_SETTING   "41Atom"

1.4.24 What kind of ATOM plug (set, M5AtomKind, val= {M5AtomSocket, M5AtomScanner}

Definition at line 140 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_ATOM_SOCKET_GLOBAL_ONOFF_SETTING

#define EPROM_PREFERENCE_ATOM_SOCKET_GLOBAL_ONOFF_SETTING   "45sock"

1.12.24 Whether the AtomSocket accepts global on/off messages

Definition at line 149 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_ATOMS_SETTING

#define EPROM_PREFERENCE_ATOMS_SETTING   "40a"

1.1.24 the preference for all the ATOM plugs (format: atomType:value} .. for now just use socket:on

Definition at line 137 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_DEBUG_INFO_SETTING

#define EPROM_PREFERENCE_DEBUG_INFO_SETTING   "37db"

a place to put some kind of Last Will of what went wrong .. for now (> max tries)

Definition at line 127 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_GROUP_NAMES_SETTING

#define EPROM_PREFERENCE_GROUP_NAMES_SETTING   "36g"

the preference setting group names to subscribe (but empty or # go to wildcard, this also supports wildcard in the future)

Definition at line 124 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_SM_COMMAND_PIR_OFF_SETTING

#define EPROM_PREFERENCE_SM_COMMAND_PIR_OFF_SETTING   "44pir"

1.11.24 The Semantic Marker command is sent on PIR, and the Command to send

Definition at line 147 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_SM_COMMAND_PIR_SETTING

#define EPROM_PREFERENCE_SM_COMMAND_PIR_SETTING   "43pir"

1.10.24 The Semantic Marker command is sent on PIR, and the Command to send

Definition at line 145 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_SM_ON_PIR_SETTING

#define EPROM_PREFERENCE_SM_ON_PIR_SETTING   "42pir"

1.10.24 Flag on whether a Semantic Marker command is sent on PIR, and the Command to send

Definition at line 143 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_SUPPORT_GROUPS_SETTING

#define EPROM_PREFERENCE_SUPPORT_GROUPS_SETTING   "35g"

the preference for supporting GROUPS (default true)

Definition at line 121 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_TIMER_INT_SETTING

#define EPROM_PREFERENCE_TIMER_INT_SETTING   "34tm"

the preference timer

Definition at line 118 of file PreferencesController.cpp.

◆ EPROM_PREFERENCE_TIMER_MAX_INT_SETTING

#define EPROM_PREFERENCE_TIMER_MAX_INT_SETTING   "39x"

11.29.23 add the max time .. so a random can be used

Definition at line 134 of file PreferencesController.cpp.

◆ EPROM_SCREEN_COLOR_SETTING

#define EPROM_SCREEN_COLOR_SETTING   "24sc"

color of the M5 screen

Definition at line 86 of file PreferencesController.cpp.

◆ EPROM_SEMANTIC_MARKER_ZOOMED_VALUE

#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE   "12sz"

display preferences zoomed or not zoomed

Definition at line 52 of file PreferencesController.cpp.

◆ EPROM_SENDWIFI_WITH_BLE

#define EPROM_SENDWIFI_WITH_BLE   "32wb"

send WIFI to all except our device (and our paired) when

Definition at line 112 of file PreferencesController.cpp.

◆ EPROM_SENSOR_PIR_VALUE

#define EPROM_SENSOR_PIR_VALUE   "11pr"

proximity PIR

Definition at line 50 of file PreferencesController.cpp.

◆ EPROM_SENSOR_PLUGS_SETTING

#define EPROM_SENSOR_PLUGS_SETTING   "51sp"

issue #338 sensor definition (in work) This will be a string in JSON format with various PIN and BUS information

Definition at line 173 of file PreferencesController.cpp.

◆ EPROM_SENSOR_TILT_VALUE

#define EPROM_SENSOR_TILT_VALUE   "TILT_10"

sensor preferences for tilt on or off

Definition at line 48 of file PreferencesController.cpp.

◆ EPROM_SENSORS_SETTING

#define EPROM_SENSORS_SETTING   "52sensors"

5.14.25 Dead 5.14.74 Montana issue #365 Object Oriented Sensors as well define the sensors (not sensorPlugs). MQTT: set:sensor, set:sensors

Definition at line 178 of file PreferencesController.cpp.

◆ EPROM_STEPPER_2FEED_SETTING

#define EPROM_STEPPER_2FEED_SETTING   "542feed"

9.3.25 back from LA, Horses out. Tyler on lap. Europe next week sets the 2feed option (go back and forth)

Definition at line 187 of file PreferencesController.cpp.

◆ EPROM_STEPPER_ANGLE_FLOAT_SETTING

#define EPROM_STEPPER_ANGLE_FLOAT_SETTING   "17sa"

sets stepper angle, a floating point number

Definition at line 63 of file PreferencesController.cpp.

◆ EPROM_STEPPER_AUTO_FEED_VALUE

#define EPROM_STEPPER_AUTO_FEED_VALUE   "6af"

auto feed

Definition at line 40 of file PreferencesController.cpp.

◆ EPROM_STEPPER_AUTO_MOTOR_DIRECTION_SETTING

#define EPROM_STEPPER_AUTO_MOTOR_DIRECTION_SETTING   "48a"

8.2.24 to let older Tumbler NOT do the auto direction (back and forth) Isue #332 it will set via message: autoMotorDirection {"set":"autoMotorDirection","val":"true"}

Definition at line 160 of file PreferencesController.cpp.

◆ EPROM_STEPPER_BUZZER_VALUE

#define EPROM_STEPPER_BUZZER_VALUE   "4bz"

buzzer on or off

Definition at line 36 of file PreferencesController.cpp.

◆ EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING

#define EPROM_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING   "50sf"

retreives the FACTORY motor direction| true default, clockwise; false = REVERSE, counterclockwise 9.8.22 false = reverse == counterclockwise true = default

Definition at line 168 of file PreferencesController.cpp.

◆ EPROM_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING

#define EPROM_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING   "31md"

retreives the motor direction| true default, clockwise; false = REVERSE, counterclockwise 9.8.22 false = reverse == counterclockwise true = default

Definition at line 109 of file PreferencesController.cpp.

◆ EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE

#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE   "9jp"

Definition at line 46 of file PreferencesController.cpp.

◆ EPROM_STEPPER_JACKPOT_FEED_VALUE

#define EPROM_STEPPER_JACKPOT_FEED_VALUE   "7jf"

jackpot feed

Definition at line 42 of file PreferencesController.cpp.

◆ EPROM_STEPPER_KIND_VALUE

#define EPROM_STEPPER_KIND_VALUE   "8sk"

the step kind

Definition at line 44 of file PreferencesController.cpp.

◆ EPROM_STEPPER_RPM_SETTING

#define EPROM_STEPPER_RPM_SETTING   "53sRPM"

8.14.25 Dead Movie from 10.19.1974 tonight.. issue #394 stepperRPM stepper RPM

Definition at line 183 of file PreferencesController.cpp.

◆ EPROM_STEPPER_SINGLE_FEED_VALUE

#define EPROM_STEPPER_SINGLE_FEED_VALUE   "5sf"

single feed mode

Definition at line 38 of file PreferencesController.cpp.

◆ EPROM_SUB_DAWGPACK_SETTING

#define EPROM_SUB_DAWGPACK_SETTING   "28dg"

8.17.22 to turn on/off subscribing to the dawgpack topic

Definition at line 98 of file PreferencesController.cpp.

◆ EPROM_USE_DOC_FOLLOW_SETTING

#define EPROM_USE_DOC_FOLLOW_SETTING   "27df"

NOTE: these EPROM have to be lockstep the same as the PREFERENCE definitions in MainModule.h.

Definition at line 95 of file PreferencesController.cpp.

◆ EPROM_USE_SPIFF_MQTT_SETTING

#define EPROM_USE_SPIFF_MQTT_SETTING   "46spiff"

4.4.24 for MQTT use of spiff (or not)

Definition at line 152 of file PreferencesController.cpp.

◆ EPROM_USE_SPIFF_QRATOM_SETTING

#define EPROM_USE_SPIFF_QRATOM_SETTING   "47spiff"

4.4.24 for QRATOM use of spiff (or not)

Definition at line 154 of file PreferencesController.cpp.

◆ EPROM_USE_SPIFF_SETTING

#define EPROM_USE_SPIFF_SETTING   "29sf"

8.22.22 to turn on/off SPIFF use

Definition at line 101 of file PreferencesController.cpp.

◆ EPROM_WIFI_CREDENTIAL_1_SETTING

#define EPROM_WIFI_CREDENTIAL_1_SETTING   "19w1"

for now, save 2 WIFI Credentials

Definition at line 69 of file PreferencesController.cpp.

◆ EPROM_WIFI_CREDENTIAL_2_SETTING

#define EPROM_WIFI_CREDENTIAL_2_SETTING   "20w2"

second wifi credential

Definition at line 71 of file PreferencesController.cpp.

◆ MAX_APPEND

#define MAX_APPEND   1500

special preference string for saving and printing back later..

Definition at line 336 of file PreferencesController.cpp.

◆ MAX_CHAIN_STRING

#define MAX_CHAIN_STRING   300

◆ NEW_SENSORS_PREFERENCE

#define NEW_SENSORS_PREFERENCE

Definition at line 1418 of file PreferencesController.cpp.

◆ NUMBER_GROUPS

#define NUMBER_GROUPS   4

8.2.24 includeGroups 8.2.24 break up the list..

Definition at line 16 of file PreferencesController.cpp.

◆ PREFERENCES_EPROM_MAIN_NAME

#define PREFERENCES_EPROM_MAIN_NAME   "MainPrefs"

the EPROM is in preferences.h

name of main prefs eprom

Definition at line 198 of file PreferencesController.cpp.

◆ secondPass [1/2]

#define secondPass   (whichPass == 1)

◆ secondPass [2/2]

#define secondPass   (whichPass == 1)

◆ STRING_MAX_SIZE

#define STRING_MAX_SIZE   40

Definition at line 17 of file PreferencesController.cpp.

Function Documentation

◆ appendPreference_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 to a number or boolean)

Definition at line 351 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ cleanEPROM_mainModule()

void cleanEPROM_mainModule ( )

clean the preferencesMainModule in EPROM

cleans the main module EPROM

Definition at line 525 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ copyString_mainModule()

char * copyString_mainModule ( char *  str)

copy string

Definition at line 1532 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ getChainUseStruct()

ChainButtonStruct * getChainUseStruct ( int  buttonNumber_1based,
int  pressKind 
)

1.27.26 moved here for generic use .. even by a non chain button 1.22.26 with puppies, cold dry outside get the ChainUseStruct for the buttonNumber (eg 1..9 (no 0) Column Major in the Matrix (but sequential here) return the definition for this 1 based button number (if any)] //TODO -1 pressKind = -1 (matches first one ..) NOTE: pressKind for Joystick is here.. 1.28.26 you can ask for BUTTON 0 (which will be the deault for the M5Atom single press (or maybe long press)

go through looking for N one (0 based)

grab the i'th struct, then look at the button number and pressKind

i is just the entry .. not the button number N'th entry

see if the right pressKind

found one .. go with it

Definition at line 2083 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChainUseStruct_mainModule()

ChainUseStruct * getChainUseStruct_mainModule ( )

get the pin use array

get the chain struct

Definition at line 1688 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ getDiscoverM5PTClicker()

boolean getDiscoverM5PTClicker ( )

get option

Definition at line 1354 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ getM5ATOMKind_MainModule()

int getM5ATOMKind_MainModule ( )

new 1.4.24 setting ATOM kind (eg. ATOM_KIND_M5_SCANNER, ATOM_KIND_M5_SOCKET)

new 1.4.24 setting ATOM kind (eg. ATOM_KIND_M5_SCANNER, ATOM_KIND_M5_SOCKET) sets global _ATOM_KIND

optimize to only call this retrieval from EPROM 1 time.. unless changing the ATOMKind

Definition at line 1399 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPreference_mainModule()

char * getPreference_mainModule ( int  preferenceID)

called to get a preference (which will be an identifier and a string, which can be converted to a number or boolean) Note: no CACHE is looked at here. It's up to the Boolean or Int to do that..

get from EPROM

Definition at line 421 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ getPreferenceATOMKind_MainModule()

char * getPreferenceATOMKind_MainModule ( )

new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner)

Definition at line 1391 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPreferenceBoolean_mainModule()

boolean getPreferenceBoolean_mainModule ( int  preferenceID)

called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)

CACHE SETTINGS 5

Definition at line 439 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPreferenceFloat_mainModule()

float getPreferenceFloat_mainModule ( int  preferenceID)

called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)

called to get a preference (which will be an identifier and a string, which can be converted to a number or boolean)

TODO: 8.18.24 add a cache for floats .. actially cache the string value??

Definition at line 507 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPreferenceInt_mainModule()

int getPreferenceInt_mainModule ( int  preferenceID)

called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)

called to get a preference (which will be an identifier and a string, which can be converted to a number or boolean)

Definition at line 491 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPreferenceString_mainModule()

char * getPreferenceString_mainModule ( int  preferenceID)

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

Definition at line 485 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSensor_mainModule()

SensorStruct * getSensor_mainModule ( char *  sensorName)

return the sensor specified or null

Definition at line 1467 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ getSensors_mainModule()

SensorsStruct * getSensors_mainModule ( )

return the sensors defined

return the sensor specified or null

Definition at line 1461 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ initAppendingPreference_mainModule()

void initAppendingPreference_mainModule ( int  preferenceID)

called to init the preference. This won't save anything until storePreference called

Preferences for the MainModule .. basically generic settings. So any settings you want, add them here. NOTE: These are just "state" values, no methods or events are generated on saving these values.. It's up to the caller to perform events such as turning on the buzzer..

Definition at line 346 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ initChainSensorStringsFromEPROM_mainModule()

void initChainSensorStringsFromEPROM_mainModule ( )

TODO add code here 1.23.26 storage for the chain sensors EPROM value .. PREFERENCE_CHAIN_SENSORS_SETTING FIRST do the registration maniually .. LATER .. parseSensros

Parse to the global..

add this which is Button -0 (not a Chain button). So if a message comes in for button 0 .. it can find this one..

has to be after the _chainUseStruct global is set...

idea is you define the button and the press kind MatrixCell is Column Major 1,4, 7 // 2,5,8 // 3,6,9

joystick buttons..

1.24.26 don't know what to do yet ... x,y (or left, top, right, botton ??)

eg:

test...

Definition at line 1877 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initPreferencesMainModule()

void initPreferencesMainModule ( )

initialize the _preferencesMainLookup with EPROM lookup names

initialize the _preferencesMainLookup with EPROM lookup names BUT these are not stored in EPROM. The next method

9.4.25 NOTE: tese are in case the EPROM wasn't set. So the EPROM is used over these values..

12.27.23 ON for all M5 (the reason is credentials ...)

12.8.22 default back TRUE default off for the M5 (but it can be turned on later..)

12.27.23 ON for most M5 , but off for the SOCKET

only the SOCKET will be off by default for now...

Sensor preferences

used for first time features..

This is a feeder that gateways to a GEN3

This is a feeder that gateways to a GEN3

REST ARE NOT CACHED

STEPPER preferences (no ifdef.. )

5.2.25 default 0.5 SECONDS (not angle for the HDriver

3.28.23 change default to 5 (from 30)

11.29.23 add a max so random can be used

set with message: set:bleusedevicename,val:on/off

12.8.22 setting to TRUE as default

1.6.23 .. PetTutor Blue app still not always discovering new syntax

set with message: set:bleusepaireddevicename,val:on/off

used for first time features..

8.17.22 to turn on/off subscribing to the dawgpack topic

//! 8.22.22 to turn on/off SPIFF use (not cached yet as it's an infrequent event)

the paired device for guest device feeding (6.6.22) .. but the Address 9.3.22

!retreives the motor direction| 0 (false) = default, clockwise; 1 (true) = REVERSE, counterclockwise 9.8.22 TRUE = reverse == counterclockwise FALSE = default

8.18.24 the factory setting retreives the motor direction| 0 (false) = default, clockwise; 1 (true) = REVERSE, counterclockwise 9.8.22 TRUE = reverse == counterclockwise FALSE = default

10.4.22

11.1.22 TODO.. messages for this..

7.26.23 added group message support (or turn it off) PREFERENCE_SUPPORT_GROUPS_SETTING default OFF 1.15.24

See also
https://github.com/konacurrents/ESP_IOT/issues/300

7.26.23 added group message support (or turn it off) PREFERENCE_GROUP_NAMES_SETTING the preference setting group names to subscribe (but empty or # go to wildcard, this also supports wildcard in the future)

a place to put some kind of Last Will of what went wrong .. for now (> max tries) 9.16.23

9.28.23 #272 only show Semantic Markers that are sent directly to the device, default OFF

1.1.24 first version of preferences for the ATOMs depending on which ATOM kind first version, only the socket and the value is on/off syntaxURL socket=off&smscanner=on

1.4.24 What kind of ATOM plug (set, M5AtomKind, val= {M5AtomSocket, M5AtomScanner}

1.10.24 The Semantic Marker command is sent on PIR, and the Command to send

1.10.24 The Semantic Marker command is sent on PIR, and the Command to send

1.11.24 The Semantic Marker command is sent on PIR, and the Command to send for OFF

1.12.24 whether global on/off is allowed. Default on..

//! 4.4.24 to turn on/off SPIFF use (not cached yet as it's an infrequent event)

//! 4.4.24 to turn on/off SPIFF use (not cached yet as it's an infrequent event)

8.2.24 to let older Tumbler NOT do the auto direction (back and forth) Isue #332 it will set via message: autoMotorDirection {"set":"autoMotorDirection","val":"true"}

8.2.24 include these groups (or none) {"set":"includeGroups","val":"group1,group2"}

issue #338 sensor definition (in work) This will be a string in JSON format with various PIN and BUS information

12.21.25 Winter Solstice, Eagles, Party, these are the CHAIN_SENSORS

5.14.25 Dead 5.14.74 Montana issue #365 Object Oriented Sensors as well define the sensors (not sensorPlugs). MQTT: set:sensor, set:sensors 7.9.25 default to BuzzerSensorClass and L9110S_DCStepperClass

8.14.25 Dead Movie from 10.19.1974 tonight.. issue #394 stepperRPM stepper RPM

9.3.25 Dead Movie.. let it grow

Definition at line 668 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initSensorStringsFromEPROM_mainModule()

void initSensorStringsFromEPROM_mainModule ( )

init the sensorString from EPROM PREFERENCE_SENSOR_PLUGS_SETTING

Parse to the global..

Definition at line 1520 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ non0string()

char * non0string ( char *  str)

return a non 0 length string

Definition at line 1962 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ parseChainSensorString_mainModule()

ChainUseStruct * parseChainSensorString_mainModule ( char *  chainUseString)

1.23.26 Cold, Clear, Mt Nice ... need to use the version above with 5 items .. pointer to the ChainSensors return array of ChainUseStruct after parsing string syntax: {SENSOR,pin1,pin2}

syntax: sensor,pin1,pin2

result

default

create memory.. (the 2nd pass would do this in the future ...)

TEMP .. until parse working ... will do the same as registerChain does..

Definition at line 1700 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ parseChainSensorString_mainModuleNEW()

ChainUseStruct * parseChainSensorString_mainModuleNEW ( char *  chainUseString)

1.23.26 Cold, Clear, Mt Nice ... need to use the version above with 5 items .. pointer to the ChainSensors return array of ChainUseStruct after parsing string syntax: {SENSOR,pin1,pin2}

syntax: sensor,pin1,pin2

result

default

needed to copy sensorsString.. as the code below broke the callers' value to "https:" .. SIDE EFFECT

resulting array

number of sensors

2 pass

for this we have MAX = 6

create the storage

reset arrayIndex (which will be increments of 3)

2 pass, first count, 2nd parseSensorString_mainModule

look for tokens, comma seperated (SEEMS cannot be null or empty .. ?? eg ,,,,

continut loop .. but increment (since code below wont' increment)

which of the max is this.. "BC,1,1,feed,,$localhost, <string> <int> <int> <string> <string> <string>

update the chain use string ..

only incremnet arrayIndex when

update the result (storage already created)

Definition at line 1720 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseIncludeGroups()

void parseIncludeGroups ( char *  groups)

8.2.24 set the include group (and cache it), called (indirectly from MQTT via setIncludeGroups

parse the groups (if nothing, then it's ok if no "," use full string)

The strtok_r() function is a reentrant version strtok(). The saveptr argument is a pointer to a char * variable that is used internally by strtok_r() in order to maintain context between successive calls that parse the same string. On the first call to strtok_r(), str should point to the string to be parsed, and the value of saveptr is ignored. In subsequent calls, str should be NULL, and saveptr should be unchanged since the previous call.

char *strtok_r(char *str, const char *delim, char **saveptr);

See also
https://www.tutorialspoint.com/c_standard_library/c_function_strtok.htm
https://linux.die.net/man/3/strtok_r

no comma

Definition at line 270 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ parseSensorString_mainModule()

SensorsStruct * parseSensorString_mainModule ( char *  sensorsString)

return array of SensorsStruct after parsing string syntax: {SENSOR,pin1,pin2}

3.29.25 Raiiiinier Beeer movie last night 5.13.25 Home with Tyler, Mom in LA Foundation triligy.. parseSensorString_mainModule the string

result

default create memory for the SensorsStruct which holds all the sensors.. the array will be created on the 2nd pass

syntax: sensor,pin1,pin2

needed to copy sensorsString.. as the code below broke the callers' value to "https:" .. SIDE EFFECT

resulting array

number of sensors

2 pass

reset arrayIndex (which will be increments of 3)

2 pass, first count, 2nd parseSensorString_mainModule

look for tokens, comma seperated

which of the max is this..

empty the class

See also
https://www.reddit.com/r/arduino/comments/1g89dlo/esp32_crashing_due_to_pinmode_and_fastled/

only incremnet arrayIndex when

update the result (storage already created)

Definition at line 1543 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printChainSensors_mainModule()

void printChainSensors_mainModule ( ChainUseStruct chainUseStruct)

print sensors, passing in a struct

print it 2 ways, one as the EPROM wouild look, the other are the chain use string

go through looking for N one (0 based)

grab the i'th struct, then look at the button number and pressKind

"JC", 3, BUTTON_JOYSTICK_RIGHT, "feed", "", "" );

Definition at line 1972 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printPreferenceValues_mainModule()

void printPreferenceValues_mainModule ( )

print the preferences to SerialDebug

this inits the string to the EPROM value

12.24.25 return the username and password, Kevin feature .. he was setting to WIFI acidently. I updated APP to make that harder note on reboot this won't be set until later, so do another ""

don't change subscription but include these groups (eg. safeHouse,atlasDogs)

1.10.24 Flag on whether a Semantic Marker command is sent on PIR, and the Command to send

1.10.24 The Semantic Marker command is sent on PIR, and the Command to send

1.11.24 The Semantic Marker command is sent on PIR, and the Command to send

1.12.24 The Semantic Marker command is sent on PIR, and the Command to send

5.14.25

12.21.25 5.14.25

8.14.25 Dead Movie from 10.19.1974 tonight.. issue #394 stepperRPM stepper RPM

9.3.25 back from LA, Horses out. Tyler on lap. Europe next week sets the 2feed option (go back and forth)

retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}

5.14.25 also print out the sensors print sensors

1.24.26 Clear day .. 2 eagles again on walk

7.31.25

TODO: add preference to not support this?? show example JSON (break up as getPreference re-uses same string...

7.31.25 PIN USE

this needs to have a long pin in the array as well 8.30.25 check if duplicates

See also
https://stackoverflow.com/questions/8199403/how-to-check-if-an-array-has-any-duplicates

Definition at line 1151 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printSensor_mainModule()

void printSensor_mainModule ( SensorStruct sensor)

print sensor

Definition at line 1438 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ printSensors_mainModule()

void printSensors_mainModule ( SensorsStruct sensors)

print sensors, passing in a struct

Definition at line 1448 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processChainUseStruct()

void processChainUseStruct ( ChainButtonStruct chainUseStruct)

1.22.26 Dead Morning Dew process the given button 1.24.26 NOTE: this doesn't care about button press or joystick .. it's just run that button

1.24.26 look at $options

special

feed .. feed always (done after the code below..)

This will send BLE to our connected device ..

create a set/val message TODO; device, etc.. topic

create a set/val message TODO; device, etc.. topic

send this message

idea is you define the button and the press kind MatrixCell is Column Major 1,4, 7 // 2,5,8 // 3,6,9

Definition at line 2120 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAppendingPreference_mainModule()

void readAppendingPreference_mainModule ( int  preferenceID)

called to init the preference. This won't save anything until storePreference called

Definition at line 340 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPreferences_mainModule()

void readPreferences_mainModule ( )

reads the preferences. Save is everytime the savePreference is called

reads the preferences. Save is everytime the savePreference is called 5.14.25 (Dead 5.14.74 3rd Wall of Sound) add the Sensors as well..

clean the cached, and initialize what are cached..

intiialize the preferences arrays from EPROM. This also updates the defaults BUT: the caches below are from the value retrieved (and defult if need be)

start the read-write of the EPROM

check some of the boolean ones to cache .. so don't have to go to the EPROM everytime..

9.4.25 STRANGE: the BOOLEAN aren't working too good so removing CLOCKWISE and STEPPER_2FEED **** NOTE: THis is where whether things are cached or not is set! Eventually all boolean and int could be cached.. CACHE SETTINGS (boolean)

8.2.24

9.3.25 strange wasn't working ... if in cache..

CACHE SETTINGS (int)

8.2.24 set the includeGroups

grab the state at the start, then it's only modified from a MQTT message

save parse (do it this way, instead of setIncludeGroups (as that stored in eprom again)

Close the Preferences

set onbootPreferences

5.14.25 (Dead 5.14.74 3rd Wall of Sound) add the Sensors as well..

1.23.26 do the same for chain 1.30.26 THIS is done whether we have the actual buttons or not, that is defined which SensorClass – ChainButtonClassType

Definition at line 549 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerChain_mainModule()

void registerChain_mainModule ( String  classType,
int  buttonNumber,
int  pressKind,
String  setString,
String  valString,
String  deviceString 
)

12.19.25 use the Chain 5.3.25 add a central clearing house for defining PIN use central clearing house for all pins used to we can analyze if there are overlaps pin is the actual number, pinName is the local name (eg. IN1_PIN or VIN_PIN). moduleName is the module in the code, isI2C is whether this is a I2C bus (which we aren't using much yet) 1.22.26 add pressKind and classType

storage is supposed to have been created .. but this line blows ..

update the n'th version grab a pointer to the size already created The array is really contiguous memory .. vs linked list, to the address of the n't array is the pointer to that struct grab the next entry (chainUseCount)

1.23.26 5.3.25 create storage here

store globally

store classType

set the buttonNumber for this chain #

pressKind

set the set for this chain #

set the set for this chain #

set the set for this chain #

increment chainUseCound

Definition at line 2021 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetAllPreferences_mainModule()

void resetAllPreferences_mainModule ( )

resets preferences.. Currently only reset all, but eventually reset(groups..)

dispatches a call to the command specified. This is run on the next loop()

Definition at line 1334 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetChainSensorToDefault_mainModule()

void resetChainSensorToDefault_mainModule ( )

1.27.26

7.9.25 reset SENSORS to default "BuzzerSensorClass,23,33,L9110S_DCStepperClass,21,25"

Definition at line 2007 of file PreferencesController.cpp.

◆ resetPreference_mainModule()

void resetPreference_mainModule ( int  preferenceID)

called to reset to blank a preference (which will be an identifier and a string, which can be converted to a number or boolean)

Definition at line 377 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePreference_mainModule()

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 number or boolean)

Definition at line 318 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ savePreferenceATOMKind_MainModule()

void savePreferenceATOMKind_MainModule ( String  value)

returned from mainModule

new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner). MQTT message "set":"M5AtomKind", val=

new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner) 1.5.24 also set the initial atom storage Then the device reboots.. so setup() and loop() are for the correct ATOM

1.5.24 also set the initial atom storage 1.4.24 use the _atomKind (which CAN change)

8.1.23 for the ATOM Lite QRCode Reader

12.26.23 for the ATOM Socket Power

Definition at line 1369 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePreferenceBoolean_mainModule()

void savePreferenceBoolean_mainModule ( int  preferenceID,
boolean  flag 
)

save a boolean preference

TODO: put them in somewhere that is saving EPROM .. a SettingsModule these are implemented in the MainModule (since they are writing to the EPROM) sets and gets the "gateway" functionality

CACHE SETTINGS 5

Definition at line 467 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePreferenceFloat_mainModule()

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 number or boolean)

convert to a string..

Definition at line 516 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePreferenceInt_mainModule()

void savePreferenceInt_mainModule ( int  preferenceID,
int  val 
)

sets an int preference

sets an int

CACHE SETTINGS 1

convert to a string..

Definition at line 387 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ savePreferenceIntFromString_mainModule()

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

sets an int, but only if a valid integer, and no signs

Definition at line 402 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChainSensorsString_mainModule()

void setChainSensorsString_mainModule ( char *  chainSensorsString)

1.23.26 Clear Day .. puppies, tyler, Clear Snowy Mt Rainier

Only 1 setSensorsString now .. will always append unless a null or blank "" string PREFERENCE_CHAIN_SENSORS_SETTING set a sensor val (array of sensor,pin,pin,sensor,pin,pin...)

for now .. resetting 5.17.25

init EPROM

store in EPROM

Parse to the global..

printout

Definition at line 1934 of file PreferencesController.cpp.

Here is the call graph for this function:

◆ setDiscoverM5PTClicker()

void setDiscoverM5PTClicker ( boolean  flag)

transient for now... 10.4.22 set the M5 PTClicker discovery option..

Definition at line 1348 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ setIncludeGroups()

void setIncludeGroups ( char *  groups)

8.2.24 set the include group (and cache it), called from MQTT

process the groups..

save persistently

Definition at line 308 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOnBootPreferences_mainModule()

void setOnBootPreferences_mainModule ( )

set some defaults on boot - that override EPROM this can be called on the HOME screen to set back to normal mode..

set some defaults on boot - that override EPROM This is also called when going back tot he MAIN menu (HOME SCREEN)

set zoomed = true (no semantic marker)

use the minimal menu on boot

Definition at line 534 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSensorsString_mainModule()

void setSensorsString_mainModule ( char *  sensorsString)

Only 1 setSensorsString now .. will always append unless a null or blank "" string set a sensor val (array of sensor,pin,pin,sensor,pin,pin...)

for now .. resetting 5.17.25

init EPROM

store in EPROM

Parse to the global..

Definition at line 1493 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ storePreference_mainModule()

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 to a number or boolean)

turn AP_DEBUG_MODe off for now... 1.1.24 seems the append is goofing things..

Definition at line 361 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testParse()

void testParse ( )

just try parsing for now..

200 fixed problem..

needs spaces between "," or won't find them .. FIX THIS ..

parse it

print it

bombing after this..

Definition at line 1855 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ togglePreferenceBoolean_mainModule()

void togglePreferenceBoolean_mainModule ( int  preferenceID)

toggles a preference boolean

Definition at line 410 of file PreferencesController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ topicInIncludeGroup()

boolean topicInIncludeGroup ( char *  topic)

8.2.24 retrieve the includeGroup really ask a topic if it's in the include group modifies the _

8.2.24 just string match for now.. NOTE: topic is a full path .. but MessageArrived: 'FEED {'deviceName':'MaggieMae'}', onTopic=usersP/groups/atlasDogs

find the topic (eg. usersP/groups/atlasDogs , is atlasDogs

go past the "/"

go through list..

empty is a find .. not specified

note "group" the short name is 2nd so it's asking if "/userP/groups/atlasDogs contains string atlasDogs that way the topic doesn't need to be parsed.. (although it could be wrong :eg atlas also matches..

Definition at line 227 of file PreferencesController.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ _appendingPreferenceString

String _appendingPreferenceString = ""

storage for the appending string

Definition at line 338 of file PreferencesController.cpp.

◆ _ATOM_KIND

int _ATOM_KIND = ATOM_KIND_M5_SCANNER

Definition at line 1362 of file PreferencesController.cpp.

◆ _cachedPreferenceBooleanValues

boolean _cachedPreferenceBooleanValues[MAX_MAIN_PREFERENCES]

Cache for heavy hitter boolean values (those referenced every loop.. seems to be hard on the EPROM to keep up: This array will only have the Boolean values set.. the 'save' will fill them, and the 'get' will return

Definition at line 213 of file PreferencesController.cpp.

◆ _cachedPreferenceIntValues

int _cachedPreferenceIntValues[MAX_MAIN_PREFERENCES]

another cache for the Int values..

Definition at line 219 of file PreferencesController.cpp.

◆ _chainSensorsEPROM

char _chainSensorsEPROM[500]

1.23.26 storage for the chain sensors EPROM value .. the memory for the chainSensorsEPROM

Definition at line 1696 of file PreferencesController.cpp.

◆ _chainUseStruct

ChainUseStruct* _chainUseStruct = NULL

global for use. This is an object (not a pointer) and has all the storage created statically

#define CHAIN_USE_MAX 10 typedef struct { ! number of chain int chainUseCount; ! the buton numbers int buttonNumberArray[PIN_USE_MAX]; ! the set strings, val strings, device strings char *setStringArray[PIN_USE_MAX]; ! val strings char *valStringArray[PIN_USE_MAX]; ! the device strings char *deviceStringArray[PIN_USE_MAX];

} ChainUseStruct;

Definition at line 1686 of file PreferencesController.cpp.

◆ _DiscoverM5PTClicker

boolean _DiscoverM5PTClicker = false

Definition at line 1345 of file PreferencesController.cpp.

◆ _firstTimeAtomKind

boolean _firstTimeAtomKind = true

if the preference was retrieved..

Definition at line 1361 of file PreferencesController.cpp.

◆ _includeGroupLen

int _includeGroupLen = 0

Definition at line 18 of file PreferencesController.cpp.

◆ _includeGroupsStringArray

char _includeGroupsStringArray[NUMBER_GROUPS][STRING_MAX_SIZE]

resulting group names

Definition at line 20 of file PreferencesController.cpp.

◆ _isCachedPreferenceBoolean

boolean _isCachedPreferenceBoolean[MAX_MAIN_PREFERENCES]

array of boolean if the ID is cached..

Definition at line 216 of file PreferencesController.cpp.

◆ _isCachedPreferenceInt

boolean _isCachedPreferenceInt[MAX_MAIN_PREFERENCES]

array of boolean if the ID is cached..

Definition at line 222 of file PreferencesController.cpp.

◆ _mqttMessage_ChainButton

char _mqttMessage_ChainButton[100]

1.27.26 Chain Buttons .. which non-chain can use too storage tor a message

Definition at line 2115 of file PreferencesController.cpp.

◆ _preferenceBuffer

char _preferenceBuffer[100]

PREFERENCES for the main module.

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..

Definition at line 10 of file PreferencesController.cpp.

◆ _preferenceBufferString

char _preferenceBufferString[100]

buffer for the string

Definition at line 12 of file PreferencesController.cpp.

◆ _preferenceMainModuleLookupDefaults

char* _preferenceMainModuleLookupDefaults[MAX_MAIN_PREFERENCES]

array of default values to store in the EPROM if not defined..

Definition at line 207 of file PreferencesController.cpp.

◆ _preferenceMainModuleLookupEPROMNames

char* _preferenceMainModuleLookupEPROMNames[MAX_MAIN_PREFERENCES]

array of preference names (those used in process()

Definition at line 205 of file PreferencesController.cpp.

◆ _preferencesMainModule

Preferences _preferencesMainModule

preferences for MAIN

Definition at line 203 of file PreferencesController.cpp.

◆ _sensorsEPROM

char _sensorsEPROM[500]

the memory for the sensorsEPROM

5.14.25 Hanging with Tyler, Dead Montana 5.14.74 great stuff add the Sensors Preference .. first the parsing 10.26.25 Power Out, Wind Storm, Tyler handing .. remove the PRINT

Definition at line 1426 of file PreferencesController.cpp.

◆ _sensorsStructs_mainModule

SensorsStruct* _sensorsStructs_mainModule = NULL

array of sensorStruct

Definition at line 1430 of file PreferencesController.cpp.