ESP_IOT v2.5
IOT ESP Coding
PreferencesController.h
Go to the documentation of this file.
1
2
3#ifndef PreferencesController_h
4#define PreferensesController_h
5
6/*STEPPER feederType*/
7#define STEPPER_IS_UNO 1
8#define STEPPER_IS_MINI 2
9#define STEPPER_IS_TUMBLER 3
10//! These are the "preferenceID" in the calls below..
11//! **** Preferences Setup, called from reading EPROM, and from someone saving a preference ****
12#define PREFERENCE_MAIN_GATEWAY_VALUE 0
13#define PREFERENCE_MAIN_BLE_SERVER_VALUE 1
14#define PREFERENCE_MAIN_BLE_CLIENT_VALUE 2
15
16//! stepper preferences
17#define PREFERENCE_STEPPER_BUZZER_VALUE 3
18//these 3 are mutually exclutive
19#define PREFERENCE_STEPPER_SINGLE_FEED_VALUE 4
20#define PREFERENCE_STEPPER_AUTO_FEED_VALUE 5
21#define PREFERENCE_STEPPER_JACKPOT_FEED_VALUE 6
22#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING 7
23//! uses STEPPER type
24#define PREFERENCE_STEPPER_KIND_VALUE 8
25#define PREFERENCE_STEPPER_FEEDS_PER_JACKPOT 9
26
27//! Sensor preferences
28#define PREFERENCE_SENSOR_TILT_VALUE 10
29#define PREFERENCE_SENSOR_PIR_VALUE 11
30//! Display preferences (SemanticMarker etc) - boolean
31#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE 12
32//! Display preferences - show messages on blank screen- boolean
33#define PREFERENCE_DISPLAY_ON_BLANK_SCREEN_VALUE 13
34//! sets the timeout value
35#define PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE 14
36//! sets the max temp for a poweroff
37#define PREFERENCE_HIGH_TEMP_POWEROFF_VALUE 15
38//! sets the max temp for a poweroff
39#define PREFERENCE_IS_MINIMAL_MENU_SETTING 16
40//! sets stepper angle, a floating point number
41//! sets screentimeout if not button clicks (set,noclick,val,seconds)
42//! NO poweroff with the GATEWAY mode
43#define PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING 17
44
45//!for now, save 2 WIFI Credentials
46#define WIFI_CREDENTIALS_MAX 2
47#define PREFERENCE_WIFI_CREDENTIAL_1_SETTING 18
48#define PREFERENCE_WIFI_CREDENTIAL_2_SETTING 19
49//!the paired device for guest device feeding (6.6.22)
50#define PREFERENCE_PAIRED_DEVICE_SETTING 20
51//!the device name itself (6.6.22)
52#define PREFERENCE_DEVICE_NAME_SETTING 21
53//!a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE
54#define PREFERENCE_FIRST_TIME_FEATURE_SETTING 22
55//! if true, only BLEClient connect to GEN3 feeders..
56#define PREFERENCE_ONLY_GEN3_CONNECT_SETTING 23
57//! ithe color of the screen 0..n
58#define PREFERENCE_SCREEN_COLOR_SETTING 24
59
60//!if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
61#define PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING 25
62//!if set, the BLE Client will look for its service base name (PTFeeder or PTClicker), but if that name
63//!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
64#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING 26
65//! for
66#define PREFERENCE_USE_DOC_FOLLOW_SETTING 27
67
68//! 8.17.22 to turn on/off subscribing to the dawgpack topic
69#define PREFERENCE_SUB_DAWGPACK_SETTING 28
70//! 8.22.22 to turn on/off SPIFF use
71#define PREFERENCE_USE_SPIFF_SETTING 29
72
73//!the paired device for guest device feeding (6.6.22) .. but the Address 9.3.22
74#define PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING 30
75
76//!retreives the motor direction| 1) = default, clockwise; 0 = REVERSE, counterclockwise 9.8.22
77//! false = reverse == counterclockwise
78//! TRUE == default
79#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING 31
80
81//! sends the WIFI to all except current device if set
82#define PREFERENCE_SENDWIFI_WITH_BLE 32
83
84//! starts the BLE Discovery notification process - which might be internal or externa (via messages).
85#define PREFERENCE_NOTIFY_BLE_DISCOVERY 33
86
87//! the preference timer
88#define PREFERENCE_TIMER_INT_SETTING 34
89
90//! ******* 1 greater than last value **** IMPORTANT *** and no gaps..
91#define MAX_MAIN_PREFERENCES 35
92
93
94//!initialize the _preferencesMainLookup with EPROM lookup names
96
97//!print the preferences to SerialDebug
99
100//! Preferences for the MainModule .. basically generic settings. So any settings you want, add them here.
101//! 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
102//! such as turning on the buzzer..
103
104//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
105void savePreference_mainModule(int preferenceID, String preferenceValue);
106
107//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
108boolean getPreferenceBoolean_mainModule(int preferenceID);
109
110//!TODO: put them in somewhere that is saving EPROM .. a SettingsModule
111//! these are implemented in the MainModule (since they are writing to the EPROM)
112//!sets and gets the "gateway" functionality
113void savePreferenceBoolean_mainModule(int preferenceID, boolean flag);
114
115//!toggles a preference boolean
116void togglePreferenceBoolean_mainModule(int preferenceID);
117
118//! called to get a preference (which will be an identifier and a string, which can be converted to a number or boolean)
119//! 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)
120//! This mean any getPreference will use the same string .. so unless the result is a number or boolean, then copy it locally..
121char* getPreference_mainModule(int preferenceID);
122
123//!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
124char* getPreferenceString_mainModule(int preferenceID);
125
126//! called to get a preference (which will be an identifier and a string, which can be converted to a number or boolean)
127int getPreferenceInt_mainModule(int preferenceID);
128
129//!sets an int
130void savePreferenceInt_mainModule(int preferenceID, int val);
131
132//!sets an int, but only if a valid integer, and no signs
133void savePreferenceIntFromString_mainModule(int preferenceID, char* val);
134
135//! called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
136float getPreferenceFloat_mainModule(int preferenceID);
137
138//!set some defaults on boot - that override EPROM this can be called on the HOME screen to set back to normal mode..
140
141//!returns if the paired device is not NONE
143
144//!returns if the paired device is not NONE
146
147//!returns if the paired device is not NONE
149
150
151//!returns if the paired device is not NONE .. returns address or device
153
154//!resets preferences.. Currently only reset all, but eventually reset(groups..)
156
157//!transient for now... 10.4.22
158//! set the M5 PTClicker discovery option..
159void setDiscoverM5PTClicker(boolean flag);
160//! get option
161boolean getDiscoverM5PTClicker();
162#endif // PreferensesController_h
void savePreferenceInt_mainModule(int preferenceID, int val)
sets an int
boolean getDiscoverM5PTClicker()
get option
float getPreferenceFloat_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void savePreferenceBoolean_mainModule(int preferenceID, boolean flag)
save a boolean preference
void setDiscoverM5PTClicker(boolean flag)
void resetAllPreferences_mainModule()
resets preferences.. Currently only reset all, but eventually reset(groups..)
boolean getPreferenceBoolean_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void togglePreferenceBoolean_mainModule(int preferenceID)
toggles a preference boolean
void savePreferenceIntFromString_mainModule(int preferenceID, char *val)
sets an int, but only if a valid integer, and no signs
void setOnBootPreferences_mainModule()
set some defaults on boot - that override EPROM this can be called on the HOME screen to set back to ...
char * getPairedDeviceOrAddress_mainModule()
returns if the paired device is not NONE .. returns address or device
Definition: MainModule.cpp:588
char * getPairedDevice_mainModule()
returns if the paired device is not NONE
Definition: MainModule.cpp:557
int getPreferenceInt_mainModule(int preferenceID)
called to get a preference (which will be an identifier and a string, which can be converted to a num...
char * getPreference_mainModule(int preferenceID)
boolean isValidPairedDevice_mainModule()
returns if the paired device is not NONE
Definition: MainModule.cpp:569
char * getPreferenceString_mainModule(int preferenceID)
returns the preference but in it's own string buffer. As long as you use it before calling getPrefere...
void printPreferenceValues_mainModule()
print the preferences to SerialDebug
void initPreferencesMainModule()
initialize the _preferencesMainLookup with EPROM lookup names
void savePreference_mainModule(int preferenceID, String preferenceValue)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
char * getPairedDeviceAddress_mainModule()
returns if the paired device is not NONE
Definition: MainModule.cpp:563