ESP_IOT v2.5
IOT ESP Coding
MainModule.h
Go to the documentation of this file.
1
2#ifndef MainModule_h
3#define MainModule_h
4
5#include "../../Defines.h"
6
7//!added 9.29.22 to support wildcards #196
8#include "TokenParser.h"
9
10//! always avaialble to others.. the model controller part of MVC. The View is in DisplayModule. The other part of Controller is the button clicks in ButtonProcess.h (but with this, there is no logic there..)
11#include "ModelController.h"
12
13//! preferences
15
16//! 3.29.25 add the TimerDelayClass
17#include "TimerDelayClass.h"
18
19//! 6.6.25 include to get the current one..
20#include "../M5AtomClassModule/M5AtomClassType.h"
21
22#ifdef TODO_CANT_GET_TO_COMPILE
23//! 6.6.25 get the current M5AtomClassType
25#else
26//! 6.7.25 hot air balloons over house..
27//! stops the motor
29//! gets if PTFeeder a surrogate for the M5Atom class
30boolean isPTFeeder_mainModule();
31#endif
32
33//!THIS IS the setup() and loop() but using the "component" name, eg MQTTNetworking()
34//!This will perform preference initializtion as well
35//! called from the setup()
36void setup_mainModule();
37
38//! called for the loop() of this plugin
39void loop_mainModule();
40
41//!cleans the main module EPROM
43
44//!stop all loops... while OTA working..
46//! if stopped
48//!restart all loops... while OTA working..
50
51//! 8.18.24 setting this will check for the factory setting..
52void setClockwiseMotorDirection_mainModule(boolean isClockwiseFlag);
53
54#define PT_SERVICE_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f0" //Pet Tutor feeder service for feed NOTE: Lower case for GEN3 compatability
55#define PT_CHARACTERISTIC_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f1" //Pet Tutor feeder characteristic NOTE: Lower case for GEN3 compatability
56
57#ifdef ESP_M5
58#define LED 2
59#endif
60
61#define TOPIC_TO_SEND (char*)"usersP/bark"
62//#define GROUP_TOPIC_TO_SEND (char*)"/usersP/groups"
63//!returns a groupTopic to use as a topic
64char *groupTopicFullName(char *groupName);
65
66//!10000 == no poweroff
67#define NO_POWEROFF_AMOUNT_MAIN 10000
68#define NO_POWEROFF_AMOUNT_STRING_MAIN (char*)"10000"
69
70
71//! 1.12.24 add a temporary LUX dark
72//! threshholdKind = 0 (LIGHT), 1=(DARK) .. others might be 2=super dark
73#define THRESHOLD_KIND_LIGHT 0
74#define THRESHOLD_KIND_DARK 1
75void setLUXThreshold_mainModule(int thresholdKind, int luxVal);
76int getLUXThreshold_mainModule(int thresholdKind);
77
78//! processes a message that might save in the EPROM.. the cmd is still passed onto other (like the stepper module)
79//! returns true if finished processing, otherwise this can be sent onto other modules (like stepper)
80//void processClientCommand_mainModule(String message);
81//! single character version of processClientCommand (since many used that already)
83//! New RegisterCallback that works across a number of callback modules
84//!
85//! callbacksModuleId
86#define CALLBACKS_MQTT 0
87#define CALLBACKS_BUTTON_MODULE 1
88#define CALLBACKS_BLE_CLIENT 2
89#define CALLBACKS_BLE_SERVER 3
90#define CALLBACKS_MODULE_MAX 4
91
92
93#define SINGLE_CLICK_BM 0
94#define MAX_CALLBACKS_BM 1
95
96//!register the callback based on the callbackType. use the callbacksModuleId for which one..
97void registerCallbackMain(int callbacksModuleId, int callbackType, void (*callback)(char*));
98//!performs the indirect callback based on the callbackType
99void callCallbackMain(int callbacksModuleId, int callbackType, char *message);
100
101//!adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time}
102void sendMessageString_mainModule(char *messageString);
103
104//!adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time}
105void sendMessageStringTopic_mainModule(char *messageString, char*topicString);
106
107//! 8.16.25 MQTT
108//!example callback: but the scope would have the pCharacteristic defined, etc..
109//!This is pased just before the setupMQTTNetworking() is called..
110void feedMessageCallback(char *message);
111
112//!supports turning on the solid light..
113void solidLightOnOff(boolean flag);
114
115//COMMON CALLBACKS
116//NOTE: This is where the true Object Oriented dynamic plug-in approaches would come in..
117// We are using #ifdef to bound the plug-in but there is still too much knowledge about wiring events to methods
118// in this code.. TODO, make more dynmaic event based..
119
120//*** The callback for "onWrite" of the bluetooth "onWrite'
121void onWriteBLEServerCallback(char *message);
122
123/*******************************BLE Server*************************************/
124//*** The callback for "onWrite" of the bluetooth "onWrite'
125void onBLEServerCallback(char *message);
126
127//! ** The callback for "status messages" of the bluetooth
128void onStatusMessageBLEServerCallback(char *message);
129
130//!prints the module configuration by looking at defines
131//! Eventually this might be an object returned letting the code
132//!know a capability is included for runtime (vs compile time) decisions
134
135//!called on single click
136//!NOTE: with BLE_CLIENT_NETWORKING, the right button and top button send a BLE command for feeding..
137void singleClickTouched(char *whichButton);
138
139//!callback for SOLID blinking led
140void solidLight(char *message);
141
142//!callback for blinking led
143void blinkMessageCallback(char *message);
144
145
146//!take a picture (calls the camera module).. what to do with picture??? TODO
147//void takePicture_MainModule();
148
149//!clean the SSID eprom (MQTT_CLEAN_SSID_EPROM)
150void cleanSSID_EPROM_MessageCallback(char *message);
151
152//!callback for SOLID blinking led
153void solidLightMessageCallback(char *message);
154
155//!clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22)
157
158//!TESTING for saying credentials are filled in via BLE (while in AP mode), so kick out of AP and continue..
159//! set that the credentials are set. Called from the MQTT after processJSONMessage() found things were good..
160//! April 8, 2022
162
163//!retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
165
166//!! cycle through the next WIFI saved credential - return next one that isn't our current one..
168
169//! sets the WIFI and MQTT user/password. It's up to the code to decide who needs to know (currently this calls APmodule..)
170void main_updateMQTTInfo(char *ssid, char *ssid_password, char *username, char *password, char *guestPassword, char *deviceName, char * host, char * port, char *locationString);
171
172//! return the username and password
173//! 12.14.23 to support calling the SMART buttons (smrun) with parameters
174char *main_getUsername();
175//! return password
176char *main_getPassword();
177//! return devicename
179//! set the scanned device name
180void main_setScannedDeviceName(char *deviceName);
181//! set the scanned group name
182//! 1.7.24
183void main_setScannedGroupName(char *groupName);
184//! return groupname -- returns "" or nil if not set,
185//! or the FULL group name topic, or nil
187//! TODO: make this a registeration approach
188
189//! 3.21.22 these are to setup for the next time the main loop() runs to call these commands..
190//! The implementation is hard coded in the ESP_IO.ino
191#define ASYNC_CALL_OTA_UPDATE 0
192//! cleans out the credentials and restarts in AP (Access Point) mode.
193#define ASYNC_CALL_CLEAN_CREDENTIALS 1
194//!cleans the EPROM totally, and reboots
195#define ASYNC_CALL_CLEAN_EPROM 2
196//!sends a 'c' to the BLE end of the code (assuming a feeder is connected). Need to morph if a real feeder
197#define ASYNC_CALL_FEED_COMMAND 3
198//!sends a 'B' to the BLE end of the code (assuming a feeder is connected).
199#define ASYNC_CALL_BUZZ_ON 4
200//!sends a 'b' to the BLE end of the code (assuming a feeder is connected).
201#define ASYNC_CALL_BUZZ_OFF 5
202//!sends a message (like #FEED) on the users topic
203#define ASYNC_SEND_MQTT_FEED_MESSAGE 6
204//!sends the status from the main module URL
205#define ASYNC_SEND_MQTT_STATUS_URL_MESSAGE 7
206
207//!sets the GATEWAY mode on
208#define ASYNC_SET_GATEWAY_ON 8
209//!sets the GATEWAY mode off
210#define ASYNC_SET_GATEWAY_OFF 9
211
212//!sets the GATEWAY mode off
213#define ASYNC_REBOOT 10
214//!sets the GATEWAY mode off
215#define ASYNC_POWEROFF 11
216//!blank the screen
217#define ASYNC_BLANKSCREEN 12
218
219//! swaps WIFI 'w'
220#define ASYNC_SWAP_WIFI 13
221//! next WIFI 'n'
222#define ASYNC_NEXT_WIFI 14
223//! restarts the WIFI (after BLE interrupt over)
224#define ASYNC_RESTART_WIFI_MQTT 15
225//! 5.15.25 add a BUZZ command (or CLICK)
226#define ASYNC_CLICK_SOUND 16
227//! the max one greater than last one
228#define ASYNC_CALL_MAX 17 //don't forget to update this MAX (last one + 1)
229
230//!these are the async with a string parameter. This sends a BLE command unless MQTT
231#define ASYNC_CALL_BLE_CLIENT_PARAMETER 0
232//!these are the async with a string parameter
233#define ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER 1
234//!these are the async with a string parameter
235#define ASYNC_JSON_MESSAGE_PARAMETER 2
236//!these are the async with a string parameter
237#define ASYNC_JSON_MQTT_MESSAGE_PARAMETER 3
238//!send REST call
239#define ASYNC_REST_CALL_MESSAGE_PARAMETER 4
240//! the max one greater than last one
241#define ASYNC_CALL_PARAMETERS_MAX 5
242
243//! dispatches a call to the command specified. This is run on the next loop()
244void main_dispatchAsyncCommand(int asyncCallCommand);
245
246//!send an async call with a string parameter. This will set store the value and then async call the command (passing the parameter)
247//!These are the ASYNC_CALL_PARAMETERS_MAX
248void main_dispatchAsyncCommandWithString(int asyncCallCommand, char *parameter);
249
250//!storage for asyncCallCommands
251void initAsyncCallFlags();
252
253//!checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false
255
256//! 5.16.25 Fountainhead, Raining cold weekend
257//! start SYNC calls starting with the SYNC_CLICK_SOUND
258#define SYNC_CLICK_SOUND 0
259#define SYNC_CALL_MAX 1
260//! the main sync command (no parameters yet)
261void main_dispatchSyncCommand(int syncCallCommand);
262
263//! 3.17.24 get the chip id
264uint32_t getChipId();
265//! 3.17.24 get the chip id as a string
266char* getChipIdString();
267
268// **** Helper Methods
269//!If nil it create one with just the null, so strlen = 0
270//!NOTE: the strdup() might be used later..
271char* createCopy(char * stringA);
272//!a char* version of startsWith (after skipping spaces)
273boolean startsWithChar(char *str, char c);
274//! if an empty string
275boolean isEmptyString(char *stringA);
276//!check if the string contains the other string (if substring is "" then no match)
277bool containsSubstring(String message, String substring);
278//!check if the string matches
279bool stringMatch(String message, String substring);
280//gets unix time..
282
283//!returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
285
286//!returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc
287//!if fullStatus, return everything, else just the ATOM stuff
288char* main_currentStatusURL(boolean fullStatus);
289
290#ifdef UNUSED
291//!sets status parts cia a a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
292void main_setStatusJSON(const char* JSONString);
293//!sets status parts cia a a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
294void main_setStatusKeyValue(const char* key, const char* value);
295#endif
296
297//!retrieves the temperature in F.
299
300//!start of the sensor updates ... TODO: tie these to the MQTT messaging as well..
302
303#ifdef NOT_USED
304//!see the external IP .. try 2.21.22
305void getExternalIP();
306#endif
307
308//!feedcount info..
310//increments .. and if MAX goes to 0 -- and sends a message on MQTT
312//! sets the feed count max
314
315//! called by the feed operation to say the device is still running.. and count it as a button click.
316//! Issue #145 8.8.22
318
319/*STEPPER feederType*/
320/*
321#define STEPPER_IS_UNO 1
322#define STEPPER_IS_MINI 2
323#define STEPPER_IS_TUMBLER 3
324 */
325//!get the feeder type (Sepper 1,2,3 ...)
327
328//!returns the max for this feeder
330
331//! shows a FEED (or whatever) then blanks the screen after N seconds
332//! NOTE: This will be a scrolling text as sometime ..
333void showText_mainModule(String text);
334
335//!SemanticMarker events
336//!This would see a DOCFollow message, and set the value.. then SM10 can display it..
337void setSemanticMarkerDocFollow_mainModule(char* SMDocFollowAddress);
338//!get the latest semantic marker for doc follow
340
341//!sends the SM on the DOCFOLLOW channel (publish it..)
342void sendSemanticMarkerDocFollow_mainModule(const char* SMDocFollowAddress);
343
344//!gets the device name
346
347//!power of devices
348//!reboot
350
351//!power off
353
354//!Semantic Marker definitions
355//! defines the semantic markers for now..
356//! Minimal 0..6 (max = 7)
357#define SM_home_simple 0 //tilt
358#define SM_home_simple_1 1 //buzz
359#define SM_home_simple_2 2 //FEED PAGE
360#define SM_home_simple_3 3 //advanced
361#define SM_HOME_SIMPLE_LAST SM_home_simple_3
362// update: MAX_SM_MIN_MODES when adding one..
363// and update the MINI-1 .. passed from MQTT to BUTTON
364
365//! //! homepage
366#define SM_smart_clicker_homepage 4
367//! //status
368#define SM_status 5
369//!WIFI ssid
370#define SM_WIFI_ssid 6
371//!guest page
372#define SM_guest_page 7
373
374//!AP MODE
375#define SM_ap_mode 8
376
377
378//!guest feed
379#define SM_guest_feed 9
380//!guest feed device
381#define SM_pair_dev 10
382//!HELP
383#define SM_help 11
384
385//! docfollow
386#define SM_doc_follow 12
387//! timer .. todo
388#define SM_timer 13
389//!REboot
390#define SM_reboot 14
391#define SM_LAST SM_reboot
392
393//!note for now, heep the max the same -- so only goes through zoom or not zoom
394//#define MAX_SM_MIN_MODES (SM_help + 1)
395#define MAX_SM_MIN_MODES (SM_HOME_SIMPLE_LAST + 1)
396#define MAX_SM_EXPANDED_MODES (SM_LAST + 1)
397
398
399//! This is needed now as message from external (not button pressing) causes a state change,
400//! but the button processing isn't knowing about it...
401//!sets the current screen mode .. which can be used by Button and Display processing
402//! whichSMMode 0..SM_LAST
403void setCurrentSMMode_mainModule(int whichSMMode);
404//!returns the current SM Mode
406//!increment the currentSMMode, wrapping and using the max menu
408//!increment the currentSMMode, wrapping and using the max menu
410
411//! returns the current max of the menu modes (using the setting of min or expanded) to determine
413//! returns the current max of the MIN menu modes (using the setting of min or expanded) to determine
415//!returns an index from 0..max of SM matching cmd, or -1 if none
416int whichSMMode_mainModule(char *cmd);
417//!returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn
418boolean matchesSMMode_mainModule(char *cmd, int whichSMMode);
419//!returns string form whichSMMode, sg "sm0", sm1 ...
420char* charSMMode_mainModule(int whichSMMode);
421//!returns which mode in (min or expanded)
423//!toggles the menu mode
425
426//! BLE Discovery Methods
427//! Connected to a BLE device with the advertised name. The syntax can include (PTFeeder:NAME) or just PTFeeder
428//! Being disconnected is already a flag isConnectedBLE ...
429void setConnectedBLEDevice_mainModule(char *deviceName, boolean isGEN3);
430//!whether the connected is a GEN3 (so the name isn't valid).
432//! returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name, or "" if nothing (not null)
434//!returns full name and address, and service.
436//!returns address part of name.
438
439//! 1.22.24 refactored to only ButtonModule knows about plugins..
440//! BUTTON PROCESSING abstraction (NOTE these are only for the M5 since the M5 Atom has it backwards)
441//!short press on buttonA (top button)
443//!long press on buttonA (top button)
445//!the long press of the side button
447//!the short press of the side button
449//!restarts all the menu states to the first one .. useful for getting a clean start. This doesn't care if the menu is being shown
451//! 1.22.24 add setup and loop at main so it can call appropriate plugs
453//! setup of buttons and sensors
455
456//!whether the string is TRUE, ON, 1
457boolean isTrueString_mainModule(String valCmdString);
458
459//! 8.28.23 Adding a way for others to get informed on messages that arrive
460//! for the set,val.
461//! 1.10.24 if deviceNameSpecified then this matches this device, otherwise for all.
462//! It's up to the receiver to decide if it has to be specified
463void messageSetVal_mainModule(char *setName, char* valValue, boolean deviceNameSpecified);
464//! 12.28.23, 8.28.23 Adding a way for others to get informed on messages that arrive
465//! for the set,val
466//! 5.21.25 SEND and CMD will be treated the same and put to "send"
467void messageSend_mainModule(char *sendValue, boolean deviceNameSpecified);
468//!TODO: have a callback regist approach
469
470
471//! 1.1.24 send status of this device after events..
473
474
475//! 2.21.25 add a way to change the button color (if any)
477
478//! 3.23.25 rainy weekend
479//! create a JSON string from the SemanticMarker
480//! https://semanticmarker.org/bot/setdevice/scott@konacurrents.com/PASS/M5AtomSocket/socket/on}
481//! Create a JSON knowing the "bot" syntax, eg. setdevice/USER/PASS/device/<set>/<flag>
482//! defined in TokenParser.h
483char *semanticMarkerToJSON_mainModule(char* semanticMarker);
484
485//! 5.3.25 add a central clearing house for defining PIN use
486//! central clearing house for all pins used to we can analyze if there are overlaps
487//! pin is the actual number, pinName is the local name (eg. IN1_PIN or VIN_PIN).
488//! moduleName is the module in the code,
489//! isI2C is whether this is a I2C bus (which we aren't using much yet)
490void registerPinUse_mainModule(long pin, String pinName, String moduleName, boolean isI2C);
491
492//! note these are the sets of pin use
493//! 8.18.25 OUCH>.. 10 .. now 20 max
494#define PIN_USE_MAX 20
495typedef struct {
497 char *pinUseArray[PIN_USE_MAX];
499//! get the pin use array
501
502#endif /* MainModule_h */
M5AtomClassType * whichM5AtomClassType()
6.6.25 get the current M5AtomClassType
void sendSemanticMarkerDocFollow_mainModule(const char *SMDocFollowAddress)
sends the SM on the DOCFOLLOW channel (publish it..)
void cleanEPROM_mainModule()
cleans the main module EPROM
void main_cleanSavedWIFICredentials()
clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22)
Definition: MainModule.cpp:967
void messageSend_mainModule(char *sendValue, boolean deviceNameSpecified)
TODO: have a callback regist approach.
Definition: MainModule.cpp:582
void main_updateMQTTInfo(char *ssid, char *ssid_password, char *username, char *password, char *guestPassword, char *deviceName, char *host, char *port, char *locationString)
sets the WIFI and MQTT user/password. It's up to the code to decide who needs to know (currently this...
void setConnectedBLEDevice_mainModule(char *deviceName, boolean isGEN3)
char * connectedBLEDeviceNameAddress_mainModule()
returns address part of name.
void cleanSSID_EPROM_MessageCallback(char *message)
take a picture (calls the camera module).. what to do with picture??? TODO
void toggleMinimalMenuMode_mainModule()
toggles the menu mode
char * charSMMode_mainModule(int whichSMMode)
returns string form whichSMMode, sg "sm0", sm1 ...
char * main_getUsername()
Definition: MainModule.cpp:988
char * groupTopicFullName(char *groupName)
returns a groupTopic to use as a topic
bool stringMatch(String message, String substring)
check if the string matches
void loop_mainModule()
called for the loop() of this plugin
Definition: MainModule.cpp:278
char * getSemanticMarkerDocFollow_mainModule()
get the latest semantic marker for doc follow
void main_setScannedGroupName(char *groupName)
void registerCallbackMain(int callbacksModuleId, int callbackType, void(*callback)(char *))
register the callback based on the callbackType. use the callbacksModuleId for which one....
Definition: MainModule.cpp:512
char * deviceName_mainModule()
gets the device name
Definition: MainModule.cpp:844
int getLUXThreshold_mainModule(int thresholdKind)
get the threshold val
void sendStatusMQTT_mainModule()
TODO: have a callback regist approach.
boolean connectedBLEDeviceIsGEN3_mainModule()
whether the connected is a GEN3 (so the name isn't valid).
char * semanticMarkerToJSON_mainModule(char *semanticMarker)
char * main_currentStatusURL(boolean fullStatus)
int minMenuModesMax_mainModule()
returns the current max of the MIN menu modes (using the setting of min or expanded) to determine
void main_setScannedDeviceName(char *deviceName)
set the scanned device name
void processClientCommandChar_mainModule(char cmd)
single character version of processClientCommand (since many used that already)
int getFeedCount_mainModule()
feedcount info..
Definition: MainModule.cpp:355
void onStatusMessageBLEServerCallback(char *message)
** The callback for "status messages" of the bluetooth
Definition: MainModule.cpp:659
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
Definition: MainModule.cpp:904
int feedCountMax_mainModule()
returns the max for this feeder
Definition: MainModule.cpp:337
void solidLight(char *message)
callback for SOLID blinking led
void setClockwiseMotorDirection_mainModule(boolean isClockwiseFlag)
8.18.24 setting this will check for the factory setting..
void sendMessageStringTopic_mainModule(char *messageString, char *topicString)
adding a synchronous call to send a message over the network (assuming MQTT but not specified),...
char * main_getScannedGroupNameTopic()
void main_credentialsUpdated()
moved here 4.25.22 (entirely from ESP_IOT.ino)
Definition: MainModule.cpp:641
void setup_mainModule()
called from the setup()
Definition: MainModule.cpp:211
void main_dispatchSyncCommand(int syncCallCommand)
the main sync command (no parameters yet)
boolean stopAllProcesses_mainModule()
if stopped
Definition: MainModule.cpp:157
void restartAllMenuStates_mainModule()
restarts all the menu states to the first one .. useful for getting a clean start....
void setSemanticMarkerDocFollow_mainModule(char *SMDocFollowAddress)
sed the address to follow
boolean isTrueString_mainModule(String valCmdString)
whether the string is TRUE, ON, 1
Definition: MainModule.cpp:549
char * main_getPassword()
return password
Definition: MainModule.cpp:994
int whichSMMode_mainModule(char *cmd)
returns an index from 0..max of SM matching cmd, or -1 if none
void main_dispatchAsyncCommandWithString(int asyncCallCommand, char *parameter)
void initAsyncCallFlags()
storage for asyncCallCommands
void registerPinUse_mainModule(long pin, String pinName, String moduleName, boolean isI2C)
void solidLightMessageCallback(char *message)
callback for SOLID blinking led
#define PIN_USE_MAX
Definition: MainModule.h:494
boolean isEmptyString(char *stringA)
if an empty string
void rebootDevice_mainModule()
Definition: MainModule.cpp:853
void poweroff_mainModule()
power off
Definition: MainModule.cpp:860
int maxMenuModes_mainModule()
returns the current max of the menu modes (using the setting of min or expanded) to determine
void buttonB_ShortPress_mainModule()
the short press of the side button
boolean isPTFeeder_mainModule()
gets if PTFeeder a surrogate for the M5Atom class
Definition: MainModule.cpp:124
bool containsSubstring(String message, String substring)
check if the string contains the other string (if substring is "" then no match)
Definition: MainModule.cpp:396
void decrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
void callCallbackMain(int callbacksModuleId, int callbackType, char *message)
performs the indirect callback based on the callbackType
Definition: MainModule.cpp:531
int getCurrentSMMode_mainModule()
returns the current SM Mode
void stopMotor_mainModule()
added 9.29.22 to support wildcards #196
Definition: MainModule.cpp:117
void stopProcessesForOTAUpdate_mainModule()
stop all loops... while OTA working..
Definition: MainModule.cpp:147
void feedMessageCallback(char *message)
Definition: MainModule.cpp:603
void resetFeedCount_mainModule()
sets the feed count max
Definition: MainModule.cpp:390
void sendMessageString_mainModule(char *messageString)
adding a synchronous call to send a message over the network (assuming MQTT but not specified),...
char * main_currentStatusJSON()
returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
void changeButtonColor_MainModule()
2.21.25 add a way to change the button color (if any)
void setup_Sensors_mainModule()
setup of buttons and sensors
char * getFullBLEDeviceName_mainModule()
returns full name and address, and service.
int getFeederType_mainModule()
get the feeder type (Sepper 1,2,3 ...)
Definition: MainModule.cpp:361
void buttonA_LongPress_mainModule()
long press on buttonA (top button)
void invokeAsyncCommands()
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
boolean startsWithChar(char *str, char c)
a char* version of startsWith (after skipping spaces)
void showText_mainModule(String text)
void setCurrentSMMode_mainModule(int whichSMMode)
sets the current screen mode .. which can be used by Button and Display processing
void onWriteBLEServerCallback(char *message)
The callback for "onWrite" of the bluetooth "onWrite'.
Definition: MainModule.cpp:756
void setLUXThreshold_mainModule(int thresholdKind, int luxVal)
set the threshold val
void main_dispatchAsyncCommand(int asyncCallCommand)
dispatches a call to the command specified. This is run on the next loop()
boolean matchesSMMode_mainModule(char *cmd, int whichSMMode)
returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn
char * getChipIdString()
3.17.24 get the chip id as a string
void refreshDelayButtonTouched_MainModule()
called by the feed operation to say the device is still running.. and count it as a button click.
Definition: MainModule.cpp:773
char * connectedBLEDeviceName_mainModule()
returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name,...
uint32_t getChipId()
3.17.24 get the chip id
boolean isMinimalMenuMode_mainModule()
returns which mode in (min or expanded)
void loop_Sensors_mainModule()
1.22.24 add setup and loop at main so it can call appropriate plugs
int getTimeStamp_mainModule()
void buttonB_LongPress_mainModule()
the long press of the side button
void blinkMessageCallback(char *message)
callback for blinking led
void restartProcessesForOTAUpdate_mainModule()
restart all loops... while OTA working..
Definition: MainModule.cpp:152
char * main_getScannedDeviceName()
return devicename
char * createCopy(char *stringA)
void main_printModuleConfiguration()
void messageSetVal_mainModule(char *setName, char *valValue, boolean deviceNameSpecified)
Definition: MainModule.cpp:560
void solidLightOnOff(boolean flag)
supports turning on the solid light..
void singleClickTouched(char *whichButton)
float getTemperature_mainModule()
retrieves the temperature in F.
void buttonA_ShortPress_mainModule()
char * main_nextJSONWIFICredential()
! cycle through the next WIFI saved credential - return next one that isn't our current one....
Definition: MainModule.cpp:910
void onBLEServerCallback(char *message)
The callback for "onWrite" of the bluetooth "onWrite'.
Definition: MainModule.cpp:652
void incrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
void incrementFeedCount_mainModule()
increments .. and if MAX goes to 0 – and sends a message on MQTT
Definition: MainModule.cpp:368
PinUseStruct getPinUseStruct_mainModule()
get the pin use array
float getBatPercentage_mainModule()
start of the sensor updates ... TODO: tie these to the MQTT messaging as well..
An mostly virtual class.