ESP_IOT v2.5
IOT ESP Coding
|
Go to the source code of this file.
Macros | |
#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_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 | PREFERENCES_EPROM_MAIN_NAME "MainPrefs" |
the EPROM is in preferences.h More... | |
Functions | |
void | initPreferencesMainModule () |
initialize the _preferencesMainLookup with EPROM lookup names 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 | 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 | 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... | |
Variables | |
char | _preferenceBuffer [100] |
PREFERENCES for the main module. More... | |
char | _preferenceBufferString [100] |
buffer for the string 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... | |
boolean | _DiscoverM5PTClicker = false |
#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 81 of file PreferencesController.cpp.
#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 84 of file PreferencesController.cpp.
#define EPROM_DEVICE_NAME_SETTING "22dn" |
the device name
Definition at line 69 of file PreferencesController.cpp.
#define EPROM_DISPLAY_ON_BLANK_SCREEN_VALUE "13bk" |
Display preferences - show messages on blank screen- boolean.
Definition at line 47 of file PreferencesController.cpp.
#define EPROM_DISPLAY_SCREEN_TIMEOUT_VALUE "14to" |
sets the timeout value
Definition at line 49 of file PreferencesController.cpp.
#define EPROM_FIRST_TIME_FEATURE_SETTING "23fs" |
a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE
Definition at line 72 of file PreferencesController.cpp.
#define EPROM_HIGH_TEMP_POWEROFF_VALUE "15pw" |
sets the max temp for a poweroff
Definition at line 51 of file PreferencesController.cpp.
#define EPROM_IS_MINIMAL_MENU_SETTING "16mm" |
whether to show the minimal or expanded menu
Definition at line 53 of file PreferencesController.cpp.
#define EPROM_MAIN_BLE_CLIENT_VALUE "3bc" |
BLEClient mode.
Definition at line 25 of file PreferencesController.cpp.
#define EPROM_MAIN_BLE_SERVER_VALUE "2bs" |
BLEServer mode.
Definition at line 23 of file PreferencesController.cpp.
#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 21 of file PreferencesController.cpp.
#define EPROM_NO_BUTTON_CLICK_POWEROFF_SETTING "18po" |
sets screentimeout if not button clicks (set,noclick,val,seconds)
Definition at line 58 of file PreferencesController.cpp.
#define EPROM_NOTIFY_BLE_DISCOVERY "33bd" |
starts the BLE Discovery notification process - which might be internal or externa (via messages).
Definition at line 107 of file PreferencesController.cpp.
#define EPROM_ONLY_GEN3_CONNECT_SETTING "23gs" |
if true, only BLEClient connect to GEN3 feeders..
Definition at line 75 of file PreferencesController.cpp.
#define EPROM_PAIRED_DEVICE_ADDRESS_SETTING "30da" |
9.3.22 eprom of the Address of desired BLE
Definition at line 96 of file PreferencesController.cpp.
#define EPROM_PAIRED_DEVICE_SETTING "21pd" |
the guest device paired with this M5 device (or NONE)
Definition at line 66 of file PreferencesController.cpp.
#define EPROM_PREFERENCE_TIMER_INT_SETTING "34tm" |
the preference timer
Definition at line 110 of file PreferencesController.cpp.
#define EPROM_SCREEN_COLOR_SETTING "24sc" |
color of the M5 screen
Definition at line 78 of file PreferencesController.cpp.
#define EPROM_SEMANTIC_MARKER_ZOOMED_VALUE "12sz" |
display preferences zoomed or not zoomed
Definition at line 44 of file PreferencesController.cpp.
#define EPROM_SENDWIFI_WITH_BLE "32wb" |
send WIFI to all except our device (and our paired) when
Definition at line 104 of file PreferencesController.cpp.
#define EPROM_SENSOR_PIR_VALUE "11pr" |
proximity PIR
Definition at line 42 of file PreferencesController.cpp.
#define EPROM_SENSOR_TILT_VALUE "TILT_10" |
sensor preferences for tilt on or off
Definition at line 40 of file PreferencesController.cpp.
#define EPROM_STEPPER_ANGLE_FLOAT_SETTING "17sa" |
sets stepper angle, a floating point number
Definition at line 55 of file PreferencesController.cpp.
#define EPROM_STEPPER_AUTO_FEED_VALUE "6af" |
auto feed
Definition at line 32 of file PreferencesController.cpp.
#define EPROM_STEPPER_BUZZER_VALUE "4bz" |
buzzer on or off
Definition at line 28 of file PreferencesController.cpp.
#define EPROM_STEPPER_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 101 of file PreferencesController.cpp.
#define EPROM_STEPPER_FEEDS_PER_JACKPOT_VALUE "9jp" |
Definition at line 38 of file PreferencesController.cpp.
#define EPROM_STEPPER_JACKPOT_FEED_VALUE "7jf" |
jackpot feed
Definition at line 34 of file PreferencesController.cpp.
#define EPROM_STEPPER_KIND_VALUE "8sk" |
the step kind
Definition at line 36 of file PreferencesController.cpp.
#define EPROM_STEPPER_SINGLE_FEED_VALUE "5sf" |
single feed mode
Definition at line 30 of file PreferencesController.cpp.
#define EPROM_SUB_DAWGPACK_SETTING "28dg" |
8.17.22 to turn on/off subscribing to the dawgpack topic
Definition at line 90 of file PreferencesController.cpp.
#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 87 of file PreferencesController.cpp.
#define EPROM_USE_SPIFF_SETTING "29sf" |
8.22.22 to turn on/off SPIFF use
Definition at line 93 of file PreferencesController.cpp.
#define EPROM_WIFI_CREDENTIAL_1_SETTING "19w1" |
for now, save 2 WIFI Credentials
Definition at line 61 of file PreferencesController.cpp.
#define EPROM_WIFI_CREDENTIAL_2_SETTING "20w2" |
second wifi credential
Definition at line 63 of file PreferencesController.cpp.
#define PREFERENCES_EPROM_MAIN_NAME "MainPrefs" |
the EPROM is in preferences.h
name of main prefs eprom
Definition at line 115 of file PreferencesController.cpp.
void cleanEPROM_mainModule | ( | ) |
clean the preferencesMainModule in EPROM
cleans the main module EPROM
Definition at line 276 of file PreferencesController.cpp.
boolean getDiscoverM5PTClicker | ( | ) |
get option
Definition at line 692 of file PreferencesController.cpp.
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 189 of file PreferencesController.cpp.
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 205 of file PreferencesController.cpp.
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)
Definition at line 269 of file PreferencesController.cpp.
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 253 of file PreferencesController.cpp.
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 247 of file PreferencesController.cpp.
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
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.. )
set with message: set:bleusedevicename,val:on/off
12.8.22 setting to TRUE as default
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
10.4.22
11.1.22 TODO.. messages for this..
Definition at line 374 of file PreferencesController.cpp.
void printPreferenceValues_mainModule | ( | ) |
print the preferences to SerialDebug
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
Definition at line 627 of file PreferencesController.cpp.
void readPreferences_mainModule | ( | ) |
reads the preferences. Save is everytime the savePreference is called
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..
CACHE SETTINGS (int)
Close the Preferences
set onbootPreferences
Definition at line 298 of file PreferencesController.cpp.
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 672 of file PreferencesController.cpp.
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)
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 140 of file PreferencesController.cpp.
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 229 of file PreferencesController.cpp.
void savePreferenceInt_mainModule | ( | int | preferenceID, |
int | val | ||
) |
sets an int preference
sets an int
CACHE SETTINGS 1
convert to a string..
Definition at line 155 of file PreferencesController.cpp.
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 170 of file PreferencesController.cpp.
void setDiscoverM5PTClicker | ( | boolean | flag | ) |
transient for now... 10.4.22 set the M5 PTClicker discovery option..
Definition at line 686 of file PreferencesController.cpp.
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 285 of file PreferencesController.cpp.
void togglePreferenceBoolean_mainModule | ( | int | preferenceID | ) |
toggles a preference boolean
Definition at line 178 of file PreferencesController.cpp.
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 128 of file PreferencesController.cpp.
int _cachedPreferenceIntValues[MAX_MAIN_PREFERENCES] |
another cache for the Int values..
Definition at line 134 of file PreferencesController.cpp.
boolean _DiscoverM5PTClicker = false |
Definition at line 683 of file PreferencesController.cpp.
boolean _isCachedPreferenceBoolean[MAX_MAIN_PREFERENCES] |
array of boolean if the ID is cached..
Definition at line 131 of file PreferencesController.cpp.
boolean _isCachedPreferenceInt[MAX_MAIN_PREFERENCES] |
array of boolean if the ID is cached..
Definition at line 137 of file PreferencesController.cpp.
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.
char _preferenceBufferString[100] |
buffer for the string
Definition at line 12 of file PreferencesController.cpp.
char* _preferenceMainModuleLookupDefaults[MAX_MAIN_PREFERENCES] |
array of default values to store in the EPROM if not defined..
Definition at line 122 of file PreferencesController.cpp.
char* _preferenceMainModuleLookupEPROMNames[MAX_MAIN_PREFERENCES] |
array of preference names (those used in process()
Definition at line 120 of file PreferencesController.cpp.
Preferences _preferencesMainModule |
preferences for MAIN
Definition at line 118 of file PreferencesController.cpp.