ESP_IOT v2.5
IOT ESP Coding
PreferencesController.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PreferensesController_h
 
#define STEPPER_IS_UNO   1
 
#define STEPPER_IS_MINI   2
 
#define STEPPER_IS_TUMBLER   3
 
#define PREFERENCE_MAIN_GATEWAY_VALUE   0
 
#define PREFERENCE_MAIN_BLE_SERVER_VALUE   1
 
#define PREFERENCE_MAIN_BLE_CLIENT_VALUE   2
 
#define PREFERENCE_STEPPER_BUZZER_VALUE   3
 stepper preferences More...
 
#define PREFERENCE_STEPPER_SINGLE_FEED_VALUE   4
 
#define PREFERENCE_STEPPER_AUTO_FEED_VALUE   5
 
#define PREFERENCE_STEPPER_JACKPOT_FEED_VALUE   6
 
#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING   7
 
#define PREFERENCE_STEPPER_KIND_VALUE   8
 uses STEPPER type More...
 
#define PREFERENCE_STEPPER_FEEDS_PER_JACKPOT   9
 
#define PREFERENCE_SENSOR_TILT_VALUE   10
 Sensor preferences. More...
 
#define PREFERENCE_SENSOR_PIR_VALUE   11
 
#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE   12
 Display preferences (SemanticMarker etc) - boolean. More...
 
#define PREFERENCE_DISPLAY_ON_BLANK_SCREEN_VALUE   13
 Display preferences - show messages on blank screen- boolean. More...
 
#define PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE   14
 sets the timeout value More...
 
#define PREFERENCE_HIGH_TEMP_POWEROFF_VALUE   15
 sets the max temp for a poweroff More...
 
#define PREFERENCE_IS_MINIMAL_MENU_SETTING   16
 sets the max temp for a poweroff More...
 
#define PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING   17
 
#define WIFI_CREDENTIALS_MAX   2
 for now, save 2 WIFI Credentials More...
 
#define PREFERENCE_WIFI_CREDENTIAL_1_SETTING   18
 
#define PREFERENCE_WIFI_CREDENTIAL_2_SETTING   19
 
#define PREFERENCE_PAIRED_DEVICE_SETTING   20
 the paired device for guest device feeding (6.6.22) More...
 
#define PREFERENCE_DEVICE_NAME_SETTING   21
 the device name itself (6.6.22) More...
 
#define PREFERENCE_FIRST_TIME_FEATURE_SETTING   22
 a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE More...
 
#define PREFERENCE_ONLY_GEN3_CONNECT_SETTING   23
 if true, only BLEClient connect to GEN3 feeders.. More...
 
#define PREFERENCE_SCREEN_COLOR_SETTING   24
 ithe color of the screen 0..n More...
 
#define PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING   25
 if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined). More...
 
#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING   26
 
#define PREFERENCE_USE_DOC_FOLLOW_SETTING   27
 for More...
 
#define PREFERENCE_SUB_DAWGPACK_SETTING   28
 8.17.22 to turn on/off subscribing to the dawgpack topic More...
 
#define PREFERENCE_USE_SPIFF_SETTING   29
 8.22.22 to turn on/off SPIFF use More...
 
#define PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING   30
 the paired device for guest device feeding (6.6.22) .. but the Address 9.3.22 More...
 
#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING   31
 
#define PREFERENCE_SENDWIFI_WITH_BLE   32
 sends the WIFI to all except current device if set More...
 
#define PREFERENCE_NOTIFY_BLE_DISCOVERY   33
 starts the BLE Discovery notification process - which might be internal or externa (via messages). More...
 
#define PREFERENCE_TIMER_INT_SETTING   34
 the preference timer More...
 
#define MAX_MAIN_PREFERENCES   35
 ******* 1 greater than last value **** IMPORTANT *** and no gaps.. More...
 

Functions

void initPreferencesMainModule ()
 initialize the _preferencesMainLookup with EPROM lookup names More...
 
void printPreferenceValues_mainModule ()
 print the preferences to SerialDebug 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...
 
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...
 
void togglePreferenceBoolean_mainModule (int preferenceID)
 toggles a preference boolean More...
 
char * getPreference_mainModule (int preferenceID)
 
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 get 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 More...
 
void savePreferenceIntFromString_mainModule (int preferenceID, char *val)
 sets an int, but only if a valid integer, and no signs 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 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...
 
boolean isValidPairedDevice_mainModule ()
 returns if the paired device is not NONE More...
 
char * getPairedDevice_mainModule ()
 returns if the paired device is not NONE More...
 
char * getPairedDeviceAddress_mainModule ()
 returns if the paired device is not NONE More...
 
char * getPairedDeviceOrAddress_mainModule ()
 returns if the paired device is not NONE .. returns address or device More...
 
void resetAllPreferences_mainModule ()
 resets preferences.. Currently only reset all, but eventually reset(groups..) More...
 
void setDiscoverM5PTClicker (boolean flag)
 
boolean getDiscoverM5PTClicker ()
 get option More...
 

Macro Definition Documentation

◆ MAX_MAIN_PREFERENCES

#define MAX_MAIN_PREFERENCES   35

******* 1 greater than last value **** IMPORTANT *** and no gaps..

Definition at line 91 of file PreferencesController.h.

◆ PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING

#define PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING   25

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

Definition at line 61 of file PreferencesController.h.

◆ PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING

#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING   26

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 64 of file PreferencesController.h.

◆ PREFERENCE_DEVICE_NAME_SETTING

#define PREFERENCE_DEVICE_NAME_SETTING   21

the device name itself (6.6.22)

Definition at line 52 of file PreferencesController.h.

◆ PREFERENCE_DISPLAY_ON_BLANK_SCREEN_VALUE

#define PREFERENCE_DISPLAY_ON_BLANK_SCREEN_VALUE   13

Display preferences - show messages on blank screen- boolean.

Definition at line 33 of file PreferencesController.h.

◆ PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE

#define PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE   14

sets the timeout value

Definition at line 35 of file PreferencesController.h.

◆ PREFERENCE_FIRST_TIME_FEATURE_SETTING

#define PREFERENCE_FIRST_TIME_FEATURE_SETTING   22

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

Definition at line 54 of file PreferencesController.h.

◆ PREFERENCE_HIGH_TEMP_POWEROFF_VALUE

#define PREFERENCE_HIGH_TEMP_POWEROFF_VALUE   15

sets the max temp for a poweroff

Definition at line 37 of file PreferencesController.h.

◆ PREFERENCE_IS_MINIMAL_MENU_SETTING

#define PREFERENCE_IS_MINIMAL_MENU_SETTING   16

sets the max temp for a poweroff

Definition at line 39 of file PreferencesController.h.

◆ PREFERENCE_MAIN_BLE_CLIENT_VALUE

#define PREFERENCE_MAIN_BLE_CLIENT_VALUE   2

Definition at line 14 of file PreferencesController.h.

◆ PREFERENCE_MAIN_BLE_SERVER_VALUE

#define PREFERENCE_MAIN_BLE_SERVER_VALUE   1

Definition at line 13 of file PreferencesController.h.

◆ PREFERENCE_MAIN_GATEWAY_VALUE

#define PREFERENCE_MAIN_GATEWAY_VALUE   0

These are the "preferenceID" in the calls below.. **** Preferences Setup, called from reading EPROM, and from someone saving a preference ****

Definition at line 12 of file PreferencesController.h.

◆ PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING

#define PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING   17

sets stepper angle, a floating point number sets screentimeout if not button clicks (set,noclick,val,seconds) NO poweroff with the GATEWAY mode

Definition at line 43 of file PreferencesController.h.

◆ PREFERENCE_NOTIFY_BLE_DISCOVERY

#define PREFERENCE_NOTIFY_BLE_DISCOVERY   33

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

Definition at line 85 of file PreferencesController.h.

◆ PREFERENCE_ONLY_GEN3_CONNECT_SETTING

#define PREFERENCE_ONLY_GEN3_CONNECT_SETTING   23

if true, only BLEClient connect to GEN3 feeders..

Definition at line 56 of file PreferencesController.h.

◆ PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING

#define PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING   30

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

Definition at line 74 of file PreferencesController.h.

◆ PREFERENCE_PAIRED_DEVICE_SETTING

#define PREFERENCE_PAIRED_DEVICE_SETTING   20

the paired device for guest device feeding (6.6.22)

Definition at line 50 of file PreferencesController.h.

◆ PREFERENCE_SCREEN_COLOR_SETTING

#define PREFERENCE_SCREEN_COLOR_SETTING   24

ithe color of the screen 0..n

Definition at line 58 of file PreferencesController.h.

◆ PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE

#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE   12

Display preferences (SemanticMarker etc) - boolean.

Definition at line 31 of file PreferencesController.h.

◆ PREFERENCE_SENDWIFI_WITH_BLE

#define PREFERENCE_SENDWIFI_WITH_BLE   32

sends the WIFI to all except current device if set

Definition at line 82 of file PreferencesController.h.

◆ PREFERENCE_SENSOR_PIR_VALUE

#define PREFERENCE_SENSOR_PIR_VALUE   11

Definition at line 29 of file PreferencesController.h.

◆ PREFERENCE_SENSOR_TILT_VALUE

#define PREFERENCE_SENSOR_TILT_VALUE   10

Sensor preferences.

Definition at line 28 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING

#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING   7

Definition at line 22 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_AUTO_FEED_VALUE

#define PREFERENCE_STEPPER_AUTO_FEED_VALUE   5

Definition at line 20 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_BUZZER_VALUE

#define PREFERENCE_STEPPER_BUZZER_VALUE   3

stepper preferences

Definition at line 17 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING

#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING   31

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

Definition at line 79 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_FEEDS_PER_JACKPOT

#define PREFERENCE_STEPPER_FEEDS_PER_JACKPOT   9

Definition at line 25 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_JACKPOT_FEED_VALUE

#define PREFERENCE_STEPPER_JACKPOT_FEED_VALUE   6

Definition at line 21 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_KIND_VALUE

#define PREFERENCE_STEPPER_KIND_VALUE   8

uses STEPPER type

Definition at line 24 of file PreferencesController.h.

◆ PREFERENCE_STEPPER_SINGLE_FEED_VALUE

#define PREFERENCE_STEPPER_SINGLE_FEED_VALUE   4

Definition at line 19 of file PreferencesController.h.

◆ PREFERENCE_SUB_DAWGPACK_SETTING

#define PREFERENCE_SUB_DAWGPACK_SETTING   28

8.17.22 to turn on/off subscribing to the dawgpack topic

Definition at line 69 of file PreferencesController.h.

◆ PREFERENCE_TIMER_INT_SETTING

#define PREFERENCE_TIMER_INT_SETTING   34

the preference timer

Definition at line 88 of file PreferencesController.h.

◆ PREFERENCE_USE_DOC_FOLLOW_SETTING

#define PREFERENCE_USE_DOC_FOLLOW_SETTING   27

for

Definition at line 66 of file PreferencesController.h.

◆ PREFERENCE_USE_SPIFF_SETTING

#define PREFERENCE_USE_SPIFF_SETTING   29

8.22.22 to turn on/off SPIFF use

Definition at line 71 of file PreferencesController.h.

◆ PREFERENCE_WIFI_CREDENTIAL_1_SETTING

#define PREFERENCE_WIFI_CREDENTIAL_1_SETTING   18

Definition at line 47 of file PreferencesController.h.

◆ PREFERENCE_WIFI_CREDENTIAL_2_SETTING

#define PREFERENCE_WIFI_CREDENTIAL_2_SETTING   19

Definition at line 48 of file PreferencesController.h.

◆ PreferensesController_h

#define PreferensesController_h

Definition at line 4 of file PreferencesController.h.

◆ STEPPER_IS_MINI

#define STEPPER_IS_MINI   2

Definition at line 8 of file PreferencesController.h.

◆ STEPPER_IS_TUMBLER

#define STEPPER_IS_TUMBLER   3

Definition at line 9 of file PreferencesController.h.

◆ STEPPER_IS_UNO

#define STEPPER_IS_UNO   1

Definition at line 7 of file PreferencesController.h.

◆ WIFI_CREDENTIALS_MAX

#define WIFI_CREDENTIALS_MAX   2

for now, save 2 WIFI Credentials

Definition at line 46 of file PreferencesController.h.

Function Documentation

◆ getDiscoverM5PTClicker()

boolean getDiscoverM5PTClicker ( )

get option

Definition at line 692 of file PreferencesController.cpp.

Here is the caller graph for this function:

◆ getPairedDevice_mainModule()

char * getPairedDevice_mainModule ( )

returns if the paired device is not NONE

Definition at line 557 of file MainModule.cpp.

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

◆ getPairedDeviceAddress_mainModule()

char * getPairedDeviceAddress_mainModule ( )

returns if the paired device is not NONE

Definition at line 563 of file MainModule.cpp.

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

◆ getPairedDeviceOrAddress_mainModule()

char * getPairedDeviceOrAddress_mainModule ( )

returns if the paired device is not NONE .. returns address or device

Definition at line 588 of file MainModule.cpp.

Here is the call 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: this reuses same string buffer so will be overwritten on next call. Save value if you need more than one result (such as WIFI credentials, ouch) This mean any getPreference will use the same string .. so unless the result is a number or boolean, then copy it locally..

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.

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 205 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)

Definition at line 269 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 get 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.

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

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.

Here is the caller graph for this function:

◆ isValidPairedDevice_mainModule()

boolean isValidPairedDevice_mainModule ( )

returns if the paired device is not NONE

returns if the paired device is not NONE

Definition at line 569 of file MainModule.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

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

Definition at line 627 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 672 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)

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.

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

sets an int

CACHE SETTINGS 1

convert to a string..

Definition at line 155 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

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

Definition at line 170 of file PreferencesController.cpp.

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

◆ setDiscoverM5PTClicker()

void setDiscoverM5PTClicker ( boolean  flag)

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

Definition at line 686 of file PreferencesController.cpp.

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 285 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 178 of file PreferencesController.cpp.

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