|
ESP_IOT v2.5
IOT ESP Coding
|
#include "../../Defines.h"#include "../M5AtomClassModule/M5AtomClassType.h"#include "../M5AtomClassModule/M5Atom_SocketModuleClass.h"#include "../M5AtomClassModule/M5Atom_QRCodeModuleClass.h"#include "../M5AtomClassModule/M5Atom_HDriverModuleClass.h"#include "../M5AtomClassModule/M5Atom_Core2ModuleClass.h"#include "../M5AtomClassModule/M5Atom_TinyGPSModuleClass.h"#include "../M5AtomClassModule/M5Atom_CameraModuleClass.h"#include "../ATOM_LED_Module/M5Display.h"#include "../SensorClass/SensorClassType.h"#include "../SensorClass/BuzzerSensorClass.h"#include "../SensorClass/KeyUnitSensorClass.h"#include "../MQTTModule/MQTTNetworking.h"#include "../BLEServerModule/BLEServerNetworking.h"#include "../BLEClientModule/BLEClientNetworking.h"
Go to the source code of this file.
Macros | |
| #define | USE_NEW_M5ATOMCLASS |
| MainModule More... | |
| #define | NUM_M5ATOM_CLASS 6 |
| #define | USE_SENSOR_CLASS |
| #define | NUM_SENSOR_CLASS 2 |
| 5.14.25 More... | |
| #define | MESSAGE_STORAGE_MAX 500 |
| global for others to use.. More... | |
| #define | NEW_SENSORS |
| #define | CALLBACKS_MQTT 0 |
| 8.16.25 MQTT More... | |
| #define | CALLBACKS_BUTTON_MODULE 1 |
| #define | CALLBACKS_BLE_CLIENT 2 |
| #define | CALLBACKS_BLE_SERVER 3 |
| #define | CALLBACKS_MAX_MQTT MQTT_MAX_CALLBACKS |
| #define | CALLBACKS_MAX_BUTTON_MODULE MAX_CALLBACKS_BM |
| #define | CALLBACKS_MAX_BLE_CLIENT BLE_CLIENT_MAX_CALLBACKS |
| #define | CALLBACKS_MAX_BLE_SERVER BLE_SERVER_MAX_CALLBACKS |
| #define | TRY_ASYNC_BLE_PROCESSING |
| #define | GROUP_TOPIC_TO_SEND (char*)"usersP/groups" |
Typedefs | |
| typedef void(* | callbackSignature) (char *) |
Functions | |
| void | initSensorClassTypeArray () |
| void | stopMotor_mainModule () |
| added 9.29.22 to support wildcards #196 More... | |
| boolean | isPTFeeder_mainModule () |
| gets if PTFeeder a surrogate for the M5Atom class More... | |
| void | readPreferences_mainModule () |
| reads the preferences. Save is everytime the savePreference is called More... | |
| void | stopProcessesForOTAUpdate_mainModule () |
| stop all loops... while OTA working.. More... | |
| void | restartProcessesForOTAUpdate_mainModule () |
| restart all loops... while OTA working.. More... | |
| boolean | stopAllProcesses_mainModule () |
| if stopped More... | |
| void | initGlobals_mainModule () |
| init globals strings More... | |
| void | setup_mainModule () |
| called from the setup() More... | |
| void | loop_mainModule () |
| called for the loop() of this plugin More... | |
| int | feedCountMax_mainModule () |
| returns the max for this feeder More... | |
| int | getFeedCount_mainModule () |
| feedcount info.. More... | |
| int | getFeederType_mainModule () |
| get the feeder type (Sepper 1,2,3 ...) More... | |
| void | incrementFeedCount_mainModule () |
| increments .. and if MAX goes to 0 – and sends a message on MQTT More... | |
| void | resetFeedCount_mainModule () |
| sets the feed count max More... | |
| bool | containsSubstring (String message, String substring) |
| check if the string contains the other string. This is a poor man's grammer checker More... | |
| void | registerCallbackMain (int callbacksModuleId, int callbackType, void(*callback)(char *)) |
| register the callback based on the callbackType. use the callbacksModuleId for which one.. More... | |
| void | callCallbackMain (int callbacksModuleId, int callbackType, char *message) |
| performs the indirect callback based on the callbackType More... | |
| void | dummyCallbackMain (char *message) |
| example callback More... | |
| callbackSignature * | createMemory (int max) |
| return dyamically created array of max More... | |
| void | initCallbacksMain () |
| init the callbacks to dummy callbacks More... | |
| boolean | isTrueString_mainModule (String valCmdString) |
| whether the string is TRUE, ON, 1 More... | |
| void | messageSetVal_mainModule (char *setName, char *valValue, boolean deviceNameSpecified) |
| void | messageSend_mainModule (char *sendValue, boolean deviceNameSpecified) |
| TODO: have a callback regist approach. More... | |
| void | feedMessageCallback (char *message) |
| void | main_credentialsUpdated () |
| moved here 4.25.22 (entirely from ESP_IOT.ino) More... | |
| void | onBLEServerCallback (char *message) |
| The callback for "onWrite" of the bluetooth "onWrite'. More... | |
| void | onStatusMessageBLEServerCallback (char *message) |
| The callback for "status messages" of the bluetooth. More... | |
| void | onWriteBLEServerCallbackFinish (char *message) |
| The FINISH of callback for "onWrite" of the bluetooth "onWrite'. More... | |
| void | onWriteBLEServerCallback (char *message) |
| The callback for "onWrite" of the bluetooth "onWrite'. More... | |
| void | refreshDelayButtonTouched_MainModule () |
| called by the feed operation to say the device is still running.. and count it as a button click. More... | |
| boolean | asyncCallOTAUpdate () |
| performs an async OTA update More... | |
| void | setAsyncCallOTAUpdate (bool flag) |
| sets the async OTA flag (for next loop) 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... | |
| boolean | isValidPairedDevice_mainModule () |
| returns if the paired device is not NONE. Note, the paired Name might be an address now (see below) More... | |
| char * | getPairedDeviceOrAddress_mainModule () |
| returns if the paired device is not NONE .. returns address or device More... | |
| char * | deviceName_mainModule () |
| gets the device name More... | |
| void | rebootDevice_mainModule () |
| void | poweroff_mainModule () |
| power off More... | |
| void | cleanEpromPreferences () |
| cleans the EPROM More... | |
| char * | main_JSONStringForWIFICredentials () |
| retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"} More... | |
| char * | main_nextJSONWIFICredential () |
| ! cycle through the next WIFI saved credential More... | |
| void | main_saveWIFICredentials (char *ssid, char *ssid_password) |
| save the WIFI credential More... | |
| void | main_cleanSavedWIFICredentials () |
| clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22) More... | |
| char * | main_getUsername () |
| char * | main_getPassword () |
| return password More... | |
| char * | main_getScannedDeviceName () |
| return devicename More... | |
| void | main_setScannedDeviceName (char *deviceName) |
| set the scanned device name More... | |
| void | main_setScannedGroupName (char *groupName) |
| char * | main_getScannedGroupNameTopic () |
| 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 (below, maybe in future a register approach) to decide who needs to know More... | |
| void | main_dispatchSyncCommand (int syncCallCommand) |
| the main sync command (no parameters yet) More... | |
| void | initAsyncCallFlags () |
| initialize the async call flags (with and without parameters) More... | |
| void | main_dispatchAsyncCommand (int asyncCallCommand) |
| checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false More... | |
| void | main_dispatchAsyncCommandWithString (int asyncCallCommand, char *parameter) |
| void | invokeAsyncCommands () |
| checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false More... | |
| void | changeButtonColor_MainModule () |
| 2.21.25 add a way to change the button color (if any) More... | |
| uint32_t | getChipId () |
| 3.17.24 get the chip id More... | |
| char * | getChipIdString () |
| 3.17.24 get the chip id as a string More... | |
| void | setLUXThreshold_mainModule (int thresholdKind, int luxVal) |
| set the threshold val More... | |
| int | getLUXThreshold_mainModule (int thresholdKind) |
| get the threshold val More... | |
| char * | groupTopicFullName (char *groupName) |
| returns a groupTopic to use as a topic More... | |
| void | blinkMessageCallback (char *message) |
| callback for blinking led More... | |
| void | solidLightMessageCallback (char *message) |
| callback for SOLID blinking led More... | |
| void | cleanSSID_EPROM_MessageCallback (char *message) |
| clean the SSID eprom (MQTT_CLEAN_SSID_EPROM) More... | |
| void | singleClickTouched (char *whichButton) |
| void | showText_mainModule (String text) |
| void | solidLightOnOff (boolean onOff) |
| callback for SOLID blinking led More... | |
| void | main_printModuleConfiguration () |
| char * | createCopy (char *stringA) |
| boolean | isEmptyString (char *stringA) |
| informs if null or empty string More... | |
| boolean | startsWithChar (char *str, char c) |
| a char* version of startsWith (after skipping spaces) More... | |
| float | getBatPercentage_mainModule () |
| start of the sensor updates ... TODO: tie these to the MQTT messaging as well.. More... | |
| void | sendMessageString_mainModule (char *messageString) |
| adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time} More... | |
| void | sendMessageStringTopic_mainModule (char *messageString, char *topicString) |
| adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time} More... | |
| float | getTemperature_mainModule () |
| retrieves the temperature . More... | |
Variables | |
| M5Atom_SocketModuleClass * | _M5Atom_SocketModuleClass |
| 5.6.25 use the M5Atom ClassType More... | |
| M5Atom_QRCodeModuleClass * | _M5Atom_QRCodeModuleClass |
| M5Atom_HDriverModuleClass * | _M5Atom_HDriverModuleClass |
| M5Atom_Core2ModuleClass * | _M5Atom_Core2ModuleClass |
| M5Atom_TinyGPSModuleClass * | _M5Atom_TinyGPSModuleClass |
| M5Atom_CameraModuleClass * | _M5Atom_CameraModuleClass |
| M5AtomClassType * | _M5AtomClassTypes [NUM_M5ATOM_CLASS] |
| 3.31.25 create array of plugs More... | |
| M5AtomClassType * | _whichM5AtomClassType |
| use this one... More... | |
| BuzzerSensorClass * | _BuzzerSensorClass |
| KeyUnitSensorClass * | _KeyUnitSensorClass |
| boolean | _stopAllProcessing = false |
| testing.. More... | |
| char | _asyncParameter [500] |
| the parameter being sent to those commands passing an argument More... | |
| char | _JSONStringForWIFICredentials [200] |
| global to store credentials when ever they are stored.. More... | |
| char | _messageStorage [MESSAGE_STORAGE_MAX] |
| char | _fullStatusString [500] |
| status string (URL query format) More... | |
| char | _smMode_MainModule [10] |
| current smMode More... | |
| char | _deviceNameSave [50] |
| saved deviceName storage.. More... | |
| boolean | _waitingForBigMessageEnd = false |
| store a big message #MSG_START .. #MSG_END More... | |
| char | _bigMessage [500] |
| char | _connectedBLEDeviceName [50] |
| saved BLE connected name 8.26.22 More... | |
| char | _fullBLEDeviceName [100] |
| full: ""Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead" More... | |
| char | _connectedBLEDeviceAddress [50] |
| full: ""Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead" More... | |
| char | _serialBuffer [300] |
| int | _feedCount_mainModule = 0 |
| 5.3.22 added a feed count approach.. (NOTE: there is a _feedCount in Dispence.cpp ... and no linker error!!! ) More... | |
| int | _callbacksFunctionsMAXS [CALLBACKS_MODULE_MAX] |
| the array of callback functions More... | |
| boolean | _callbacksInitializedMain = false |
| flag for initializing if not yes More... | |
| callbackSignature * | _allCallbacks [CALLBACKS_MODULE_MAX] |
| array of known size (CALLBACKS_MODULE_MAX) of callbackSignatures More... | |
| boolean | _asyncCallOTAUpdateFlag = false |
| 3.28.22 .. implemented in ESP_IOT.ino More... | |
| char * | _MQTT_Password = (char*)"" |
| 12.14.23 More... | |
| char * | _MQTT_Username = (char*)"" |
| char | _scannedDeviceName [100] |
| char | _scannedGroupTopicName [100] |
| boolean | _asyncCallFlags [ASYNC_CALL_MAX] |
| storage for asyncCallCommands More... | |
| boolean | _asyncCallFlagsParameters [ASYNC_CALL_PARAMETERS_MAX] |
| array of async flags for the different ASYNC_CALl values More... | |
| uint32_t | _chipID_MainModule = 0 |
| 3.17.24 the unqiue chip id More... | |
| char | _chipIdString_MainModule [15] |
| string like: 10311304 More... | |
| int | _thresholdLUXDark = 80 |
| int | _thresholdLUXLight = 0 |
| char | _groupTopicName [100] |
| char * | _ON_LIGHT = (char*)"ON" |
| char * | _OFF_LIGHT = (char*)"OFF" |
/password/status?BLE:on&numfeeds=8&WIFI:on&AP:off | |
NEW: 4.30.22 returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc as a URL: SemanticMarker.org/bot/sample/scott | |
| char * | _lastSemanticMarkerDocFollow = NULL |
| int | _saveWhichSMMode = 0 |
| the saved SMMode More... | |
| boolean | _connecteBLEisGEN3 = false |
| whether connected GEN3 More... | |
| PinUseStruct | _pinUseStruct |
| 7.31.25 add this for a status, saw that QRCode was using 22 also .. so buzer didn't work. More... | |
| char * | main_currentStatusJSON () |
| status in JSON format, needs to return something as a ',' is already added before calling this.. More... | |
| void | addStatusStringFlag (const char *key, char *val) |
| adds a query string "&key=value" More... | |
| void | addStatusBooleanFlag (const char *key, boolean flag) |
| adds to _fullStatusString a query string "&key=value" More... | |
| void | addMoreStatusQueryString () |
| char * | main_currentStatusURL (boolean fullStatus) |
| void | setSemanticMarkerDocFollow_mainModule (char *SMDocFollowAddress) |
| sed the address to follow More... | |
| char * | getSemanticMarkerDocFollow_mainModule () |
| gets the semanticAddress SemanticMarker™ More... | |
| void | sendSemanticMarkerDocFollow_mainModule (const char *SMDocFollowAddress) |
| sends the SM on the DOCFOLLOW channel (publish it..) More... | |
| void | setClockwiseMotorDirection_mainModule (boolean isClockwiseFlag) |
| 8.18.24 setting this will check for the factory setting.. More... | |
| void | processClientCommandChar_mainModule (char cmd) |
| single character version of processClientCommand (since many used that already) More... | |
| int | getTimeStamp_mainModule () |
| int | whichSMMode_mainModule (char *cmd) |
| ************** SM Mode Processing *************** More... | |
| boolean | matchesSMMode_mainModule (char *cmd, int whichSMMode) |
| returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn More... | |
| char * | charSMMode_mainModule (int whichSMMode) |
| returns string form whichSMMode, sg "sm0", sm1 ... More... | |
| boolean | isMinimalMenuMode_mainModule () |
| returns which mode in (min or expanded) More... | |
| void | toggleMinimalMenuMode_mainModule () |
| toggles the menu mode More... | |
| int | minMenuModesMax_mainModule () |
| returns the current max of the MIN menu modes (using the setting of min or expanded) to determine More... | |
| int | maxMenuModes_mainModule () |
| returns the current max of the menu modes (using the setting of min or expanded) to determine More... | |
| void | setCurrentSMMode_mainModule (int whichSMMode) |
| sets the current screen mode .. which can be used by Button and Display processing More... | |
| int | getCurrentSMMode_mainModule () |
| returns the current SM Mode More... | |
| void | incrementSMMode_mainModule () |
| increment the currentSMMode, wrapping and using the max menu More... | |
| void | decrementSMMode_mainModule () |
| increment the currentSMMode, wrapping and using the max menu More... | |
| char * | getFullBLEDeviceName_mainModule () |
| full: ""Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead" More... | |
| boolean | connectedBLEDeviceIsGEN3_mainModule () |
| whether the connected is a GEN3 (so the name isn't valid) More... | |
| void | setConnectedBLEDevice_mainModule (char *deviceName, boolean isGEN3) |
| char * | connectedBLEDeviceName_mainModule () |
| returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name, or "" if nothing (not null) More... | |
| char * | connectedBLEDeviceNameAddress_mainModule () |
| returns address part of name. More... | |
| M5AtomClassType * | whichM5AtomClassType () |
| 6.6.25 get the current M5AtomClassType More... | |
| void | loop_Sensors_mainModule () |
| 1.22.24 add setup and loop at main so it can call appropriate plugs More... | |
| void | setup_Sensors_mainModule () |
| 1.22.24 setup of buttons More... | |
| void | buttonA_ShortPress_mainModule () |
| void | buttonA_LongPress_mainModule () |
| long press on buttonA (top button) More... | |
| void | buttonB_LongPress_mainModule () |
| the long press of the side button More... | |
| void | buttonB_ShortPress_mainModule () |
| the short press of the side button More... | |
| void | restartAllMenuStates_mainModule () |
| 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 More... | |
| void | sendStatusMQTT_mainModule () |
| 1.1.24 send status of this device after events.. More... | |
| char * | semanticMarkerToJSON_mainModule (char *semanticMarker) |
| PinUseStruct | getPinUseStruct_mainModule () |
| get the pin use array More... | |
| void | registerPinUse_mainModule (long pin, String pinName, String moduleName, boolean isI2C) |
| #define CALLBACKS_BLE_CLIENT 2 |
Definition at line 422 of file MainModule.cpp.
| #define CALLBACKS_BLE_SERVER 3 |
Definition at line 423 of file MainModule.cpp.
| #define CALLBACKS_BUTTON_MODULE 1 |
Definition at line 421 of file MainModule.cpp.
| #define CALLBACKS_MAX_BLE_CLIENT BLE_CLIENT_MAX_CALLBACKS |
Definition at line 436 of file MainModule.cpp.
| #define CALLBACKS_MAX_BLE_SERVER BLE_SERVER_MAX_CALLBACKS |
Definition at line 437 of file MainModule.cpp.
| #define CALLBACKS_MAX_BUTTON_MODULE MAX_CALLBACKS_BM |
Definition at line 435 of file MainModule.cpp.
| #define CALLBACKS_MAX_MQTT MQTT_MAX_CALLBACKS |
make sure these are the number of callbacks.. 0..n These values are from the respective .h of the modules
Definition at line 434 of file MainModule.cpp.
| #define CALLBACKS_MQTT 0 |
8.16.25 MQTT
8.16.25 BLE SERVER 8.16.25 BLE CLIENT New RegisterCallback that works across a number of callback modules
callbacksModuleId
Definition at line 420 of file MainModule.cpp.
| #define GROUP_TOPIC_TO_SEND (char*)"usersP/groups" |
Definition at line 1585 of file MainModule.cpp.
| #define MESSAGE_STORAGE_MAX 500 |
global for others to use..
Definition at line 171 of file MainModule.cpp.
| #define NEW_SENSORS |
| #define NUM_M5ATOM_CLASS 6 |
make sure this is updated. 8.16.25 == 6
Definition at line 46 of file MainModule.cpp.
| #define NUM_SENSOR_CLASS 2 |
5.14.25
Definition at line 63 of file MainModule.cpp.
| #define TRY_ASYNC_BLE_PROCESSING |
| #define USE_NEW_M5ATOMCLASS |
Definition at line 5 of file MainModule.cpp.
| #define USE_SENSOR_CLASS |
Definition at line 56 of file MainModule.cpp.
| typedef void(* callbackSignature) (char *) |
Definition at line 461 of file MainModule.cpp.
| void addMoreStatusQueryString | ( | ) |
sets the "Module Status" in queryString == name=val&name=val ...
value of WIFI connected 8.16.25 MQTT
8.16.25 BLE CLIENT
connected == we are connected to another BLEServer
8.16.25 WIFI AP not done is what we look for ..
8.16.25 BLE SERVER
add a bleS=PTFeeder:name
show Z for buZZ
show G for gateway
8.10.25 #393 add stepper angle show SA for stepper angle float ..
P = paired
add the canister and stepper angle per #278
Definition at line 2065 of file MainModule.cpp.


| void addStatusBooleanFlag | ( | const char * | key, |
| boolean | flag | ||
| ) |
adds to _fullStatusString a query string "&key=value"
Definition at line 2058 of file MainModule.cpp.


| void addStatusStringFlag | ( | const char * | key, |
| char * | val | ||
| ) |
adds a query string "&key=value"
TODO: fix syntax. If just sensor sensor status: .... https://SemanticMarker.org/bot/sensor/scott@konacurrents.com/doggy/status?v=v2&dev=M5Ski&b=68&temp=66&c=0&t=8&W=on&M=on&B=on&C=on&A=off&T=on&S=on&Z=off&t=8 not working just added Z=on/off length = 157 going to remove the username/password to shorten..
Definition at line 2051 of file MainModule.cpp.

| boolean asyncCallOTAUpdate | ( | ) |
performs an async OTA update
Definition at line 783 of file MainModule.cpp.
| void blinkMessageCallback | ( | char * | message | ) |
callback for blinking led
Definition at line 1598 of file MainModule.cpp.


| void buttonA_LongPress_mainModule | ( | ) |
long press on buttonA (top button)
5.6.25 use object version
Definition at line 3274 of file MainModule.cpp.


| void buttonA_ShortPress_mainModule | ( | ) |
BUTTON PROCESSING abstraction short press on buttonA (top button)
5.6.25 use object version
Definition at line 3254 of file MainModule.cpp.


| void buttonB_LongPress_mainModule | ( | ) |
the long press of the side button
Definition at line 3296 of file MainModule.cpp.

| void buttonB_ShortPress_mainModule | ( | ) |
the short press of the side button
Definition at line 3307 of file MainModule.cpp.

| void callCallbackMain | ( | int | callbacksModuleId, |
| int | callbackType, | ||
| char * | message | ||
| ) |
performs the indirect callback based on the callbackType
Definition at line 531 of file MainModule.cpp.


| void changeButtonColor_MainModule | ( | ) |
2.21.25 add a way to change the button color (if any)
Definition at line 1513 of file MainModule.cpp.

| char * charSMMode_mainModule | ( | int | whichSMMode | ) |
returns string form whichSMMode, sg "sm0", sm1 ...
returns string form whichSMMode, sg "sm0", sm1 ... This can (and is) called by multiple places (like ButtonProcessing and MainModule
Definition at line 2886 of file MainModule.cpp.

| void cleanEpromPreferences | ( | ) |
cleans the EPROM
8.16.25 MQTT
8.16.25 WIFI AP
7.29.25 set the FIRST time ..
reboot
Definition at line 880 of file MainModule.cpp.


| void cleanSSID_EPROM_MessageCallback | ( | char * | message | ) |
clean the SSID eprom (MQTT_CLEAN_SSID_EPROM)
take a picture (calls the camera module).. what to do with picture??? TODO
call the already defined solid led defined in Dispense.cpp 8.16.25 WIFI AP clean_SSID_WIFICredentials(); now register an async call..
Definition at line 1632 of file MainModule.cpp.


| boolean connectedBLEDeviceIsGEN3_mainModule | ( | ) |
whether the connected is a GEN3 (so the name isn't valid)
whether the connected is a GEN3 (so the name isn't valid).
Definition at line 2981 of file MainModule.cpp.

| char * connectedBLEDeviceName_mainModule | ( | ) |
returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name, or "" if nothing (not null)
ISSUE: if BLE, can only return the address.. it's up to the caller to know it might not match the Paired Name (eg DukeGEN3) returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name
8.16.25 BLE CLIENT
if connected, return the connected name, otherwise return empty string
Definition at line 3077 of file MainModule.cpp.


| char * connectedBLEDeviceNameAddress_mainModule | ( | ) |
returns address part of name.
8.16.25 BLE CLIENT
if connected, return the connected name, otherwise return empty string
Definition at line 3101 of file MainModule.cpp.


| bool containsSubstring | ( | String | message, |
| String | substring | ||
| ) |
check if the string contains the other string. This is a poor man's grammer checker
check if the string contains the other string (if substring is "" then no match)
Definition at line 396 of file MainModule.cpp.

| char * createCopy | ( | char * | stringA | ) |
If nil it create one with just the null, so strlen = 0 NOTE: the strdup() might be used later..
Definition at line 1831 of file MainModule.cpp.

| callbackSignature * createMemory | ( | int | max | ) |
return dyamically created array of max
Definition at line 465 of file MainModule.cpp.


| void decrementSMMode_mainModule | ( | ) |
increment the currentSMMode, wrapping and using the max menu
Definition at line 2958 of file MainModule.cpp.
| char * deviceName_mainModule | ( | ) |
gets the device name
Definition at line 844 of file MainModule.cpp.


| void dummyCallbackMain | ( | char * | message | ) |
example callback
Definition at line 441 of file MainModule.cpp.

| int feedCountMax_mainModule | ( | ) |
returns the max for this feeder
Definition at line 337 of file MainModule.cpp.


| void feedMessageCallback | ( | char * | message | ) |
8.16.25 MQTT example callback: but the scope would have the pCharacteristic defined, etc.. This is passed just before the setupMQTTNetworking() is called..
sends this single character to the StepperModule
increment the feed count .. TODO .. see if this is good place..
the FEED was send over MQTT, now what to do? WIth the StepperModule – it just performs the feeding internalls if using the BLE_CLIENT then we have the potential to send to over BLE to the server (another feeder, GEN3 or ESP32). The issue is that ESP32 feeders are receiving the same MQTT message (usually unless MQTT turned off So the gatewayMode can be set (or in the EPROM) using {'cmd':'gatewayOn'}
8.16.25 BLE CLIENT
send the feed over the BLE client (if connected)
Definition at line 603 of file MainModule.cpp.


| float getBatPercentage_mainModule | ( | ) |
start of the sensor updates ... TODO: tie these to the MQTT messaging as well..
the M5.Axp.GetBatVoltage() is VERY slow on the M5 (as there isn't one..)
Definition at line 1875 of file MainModule.cpp.

| uint32_t getChipId | ( | ) |
3.17.24 get the chip id
Definition at line 1527 of file MainModule.cpp.

| char * getChipIdString | ( | ) |
3.17.24 get the chip id as a string
Definition at line 1542 of file MainModule.cpp.


| int getCurrentSMMode_mainModule | ( | ) |
returns the current SM Mode
Definition at line 2940 of file MainModule.cpp.

| int getFeedCount_mainModule | ( | ) |
feedcount info..
Definition at line 355 of file MainModule.cpp.

| int getFeederType_mainModule | ( | ) |
get the feeder type (Sepper 1,2,3 ...)
Definition at line 361 of file MainModule.cpp.


| char * getFullBLEDeviceName_mainModule | ( | ) |
full: ""Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead"
returns full name and address, and service.
8.16.25 BLE CLIENT
Definition at line 2967 of file MainModule.cpp.


| int getLUXThreshold_mainModule | ( | int | thresholdKind | ) |
get the threshold val
Definition at line 1568 of file MainModule.cpp.
| char * getPairedDevice_mainModule | ( | ) |
returns if the paired device is not NONE
Definition at line 794 of file MainModule.cpp.


| char * getPairedDeviceAddress_mainModule | ( | ) |
returns if the paired device is not NONE
Definition at line 800 of file MainModule.cpp.


| char * getPairedDeviceOrAddress_mainModule | ( | ) |
returns if the paired device is not NONE .. returns address or device
Definition at line 825 of file MainModule.cpp.

| PinUseStruct getPinUseStruct_mainModule | ( | ) |
get the pin use array
Definition at line 3358 of file MainModule.cpp.

| char * getSemanticMarkerDocFollow_mainModule | ( | ) |
gets the semanticAddress SemanticMarker™
get the latest semantic marker for doc follow
Definition at line 2197 of file MainModule.cpp.
| float getTemperature_mainModule | ( | ) |
retrieves the temperature .
retrieves the temperature in F.
return celcius float temperature = M5.Axp.GetTempInAXP192();
Definition at line 1952 of file MainModule.cpp.


| int getTimeStamp_mainModule | ( | ) |
On the esp32, sec is all we can handle. We can return as a double if milisecond resolution is needed. This is the time since app started.. https://randomnerdtutorials.com/epoch-unix-time-esp32-arduino/
7.27.25 miliseconds .. convert to seconds
Definition at line 2836 of file MainModule.cpp.

| char * groupTopicFullName | ( | char * | groupName | ) |
returns a groupTopic to use as a topic
Definition at line 1587 of file MainModule.cpp.

| void incrementFeedCount_mainModule | ( | ) |
increments .. and if MAX goes to 0 – and sends a message on MQTT
8.16.25 MQTT
NOTE: don't send "feed" as it might trigger a FEED ...
called by the feed operation to say the device is still running.. and count it as a button click. Issue #145 8.8.22
Definition at line 368 of file MainModule.cpp.


| void incrementSMMode_mainModule | ( | ) |
increment the currentSMMode, wrapping and using the max menu
Definition at line 2946 of file MainModule.cpp.

| void initAsyncCallFlags | ( | ) |
initialize the async call flags (with and without parameters)
storage for asyncCallCommands
Definition at line 1101 of file MainModule.cpp.

| void initCallbacksMain | ( | ) |
init the callbacks to dummy callbacks
only place for #ifdef (NOTE some can be 0 based on the #ifdef module not being included.. 8.16.25 MQTT
8.16.25 BLE SERVER
8.16.25 BLE CLIENT
Definition at line 479 of file MainModule.cpp.


| void initGlobals_mainModule | ( | ) |
init globals strings
NOTE: this is definitely needed, as grabbing strings willy nilly can bomb or corrupt stuff..
1.7.24
Definition at line 191 of file MainModule.cpp.


| void initSensorClassTypeArray | ( | ) |
init will look at those SensorClass known above, and look to see which ones are defined by the user in the SensorsStruct A report will show which ones were not found
return the sensor specified or null
all the sensors defined sensors is an array of sensor
go through the defined sensorName and instantiate those classes
init this class
store the class type instance
setup and then setPins..
call setup
find missing sensors go throug the defined sensorName and instantiate those classes
missing instance
Definition at line 70 of file MainModule.cpp.


| void invokeAsyncCommands | ( | ) |
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false
8.16.25 BLE CLIENT
8.16.25 MQTT
The FINISH of callback for "onWrite" of the bluetooth "onWrite' 1.10.24 add ability to send a MQTT Semantic Marker message This sends a MQTT message. Currently GROUP not supported TODO: add GROUP 3.9.24 REST call now process those that don't have a string parameter 8.16.25 MQTT 8.16.25 WIFI AP 8.16.25 MQTT register the 2 callbacks for now.. this is a sending of the message 8.16.25 MQTT 8.16.25 BLE CLIENT 9.30.22 IF SET .. send a feed but to all devices except ours and our pair (if any) uses new wildcard syntax either ! OUR NAME [ & ! OUR_CONNECTED_NAME if not paired, then feed everyone except out device... if not BLE connected .. send wifi fee to all below... 8.16.25 BLE CLIENT returns whether connected over BLE as a client to a server(like a ESP feeder) If not connected over BLE – then send the MQTT feed message.. ??? WHY?? 8.16.25 MQTT only if not WIFI with BLE 8.20.24 put back to MQTT feed to all .. for now.. SerialCall.println("async_send_feed.1");
send a BLE feed command as we are connected
perform ACK too 8.16.25 MQTT
this is a sending of the message 5.15.25 Sodbuster Rod plowing/disking in minutes with Mark and Bud
set the persistence (Note, this is locally saved. If sending elsewhere .. then they have to set their value)
OK: issue. if we are an ESP feeder, the STEPPER is on .. so we're good, if an M5 - then either send over BLE or MQTT
send via BLE or MQTT .. 8.16.25 BLE CLIENT returns whether connected over BLE as a client to a server(like a ESP feeder)
If not connected over BLE – then send the MQTT buzzon message.. 8.16.25 MQTT
send over BLE...
setGatewayOn/Off called from the processJSON message in MQTT or via the EPROM setting (TODO)
sends the status from the main module URL 8.16.25 MQTT
NO MORE: sendDocFollowMessageMQTT(statusURL);
8.16.25 MQTT
These are the ASYNC_CALL_PARAMETERS_MAX NO: just change our credentials ...
8.16.25 MQTT Restarts (or attempts) a restart of the WIFI using the existing credentials – vs the 'n' command
Definition at line 1167 of file MainModule.cpp.


| boolean isEmptyString | ( | char * | stringA | ) |
informs if null or empty string
if an empty string
Definition at line 1840 of file MainModule.cpp.

| boolean isMinimalMenuMode_mainModule | ( | ) |
returns which mode in (min or expanded)
Definition at line 2896 of file MainModule.cpp.


| boolean isPTFeeder_mainModule | ( | ) |
gets if PTFeeder a surrogate for the M5Atom class
Defines the name of the service of the server, which for M5 will be PTClicker
Definition at line 124 of file MainModule.cpp.

| boolean isTrueString_mainModule | ( | String | valCmdString | ) |
whether the string is TRUE, ON, 1
Definition at line 549 of file MainModule.cpp.

| boolean isValidPairedDevice_mainModule | ( | ) |
returns if the paired device is not NONE. Note, the paired Name might be an address now (see below)
returns if the paired device is not NONE
Definition at line 806 of file MainModule.cpp.


| void loop_mainModule | ( | ) |
called for the loop() of this plugin
6.20.25 works with full code (JSON, or single commands - with '.' as help) 6.19.25 Mt Peak finally (kept to 124 bpm) Per ##373 let the serial monitor get some input, and let us set a few features see if data on the serial input Re-indexed and now command completion works!!!!!! 3 years later.
save globally for the callback below..
call the callback specified from the caller (eg. NimBLE_PetTutor_Server .. or others)
Definition at line 278 of file MainModule.cpp.


| void loop_Sensors_mainModule | ( | ) |
1.22.24 add setup and loop at main so it can call appropriate plugs
these are the plugin modules .. and only 1 active at a time except for ATOM
5.6.25 use object version
Definition at line 3123 of file MainModule.cpp.


| void main_cleanSavedWIFICredentials | ( | ) |
clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22)
go through the saved WIFI credentials and empty them with "" (vs null)
cannot null but can make stringlen=0
Definition at line 967 of file MainModule.cpp.

| void main_credentialsUpdated | ( | ) |
moved here 4.25.22 (entirely from ESP_IOT.ino)
April 8, 2022 set that the credentials are set. Called from the MQTT after processJSONMessage() found things were good..
8.16.25 WIFI AP
Definition at line 641 of file MainModule.cpp.


| char * main_currentStatusJSON | ( | ) |
status in JSON format, needs to return something as a ',' is already added before calling this..
returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
Sample format: {"status": [ { "BLE": "on" }, { "numfeeds": "8", "maxfeeds": "16" }, { "battery": "87" }, { "buzzon": "on" }, { "MQTT": "on" }, { "WIFI": "on" }, { "AP": "off" }, { "tilt": "55" } ] }
1.4.24 work on ATOM kinds without IFDEF (except to bring in the code)
5.6.25 use object version
Definition at line 2022 of file MainModule.cpp.


| char * main_currentStatusURL | ( | boolean | fullStatus | ) |
returns a string in in URL so: status?battery=84'&buzzon='off' } .. etc if fullStatus, return everything, else just the ATOM stuff
7.20.25 add T too
8.16.25 MQTT
TODO: make sure no spaces ... unless escaped
8.16.25 MQTT
TODO: make sure no spaces ... unless escaped
5.6.25 use object version
TODO: put these somewhere somehow (expandable easily..architecturally. eg. setStatus("battery","87") key,val the JSON DB supports db["battery"]=87 like syntax..
Definition at line 2131 of file MainModule.cpp.


| void main_dispatchAsyncCommand | ( | int | asyncCallCommand | ) |
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false
dispatches a call to the command specified. This is run on the next loop()
this just sets the flag, it's the next loop that makes the call
Definition at line 1118 of file MainModule.cpp.

| void main_dispatchAsyncCommandWithString | ( | int | asyncCallCommand, |
| char * | parameter | ||
| ) |
send an async call with a string parameter. This will set store the value and then async call the command (passing the parameter) These are the ASYNC_CALL_PARAMETERS_MAX
store in the parameter mailbox
this just sets the flag, it's the next loop that makes the call
6.15.25 Fathers Day seems issue when a GROVE or other sensor plugged in the main loop isn't working. SO for now, if the command is "r" then do an actual reboot..
Definition at line 1136 of file MainModule.cpp.


| void main_dispatchSyncCommand | ( | int | syncCallCommand | ) |
the main sync command (no parameters yet)
5.16.25 Fountainhead, Raining cold weekend start SYNC calls starting with the SYNC_CLICK_SOUND
5.15.25 see if the Buzzer class is defined .. if so, then call local message
perform the click sound.. this will be the sensors...
Definition at line 1063 of file MainModule.cpp.


| char * main_getPassword | ( | ) |
return password
Definition at line 994 of file MainModule.cpp.

| char * main_getScannedDeviceName | ( | ) |
return devicename
Definition at line 1000 of file MainModule.cpp.

| char * main_getScannedGroupNameTopic | ( | ) |
return groupname – returns "" or nil if not set, or the FULL group name topic, or nil
Definition at line 1029 of file MainModule.cpp.

| char * main_getUsername | ( | ) |
return the username and password 12.14.23 to support calling the SMART buttons (smrun) with parameters
Definition at line 988 of file MainModule.cpp.

| char * main_JSONStringForWIFICredentials | ( | ) |
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
Definition at line 904 of file MainModule.cpp.

| char * main_nextJSONWIFICredential | ( | ) |
! cycle through the next WIFI saved credential
! cycle through the next WIFI saved credential - return next one that isn't our current one..
WIFI_CREDENTIALS_MAX
jump out of loop if no match.. so index is valid
Definition at line 910 of file MainModule.cpp.


| void main_printModuleConfiguration | ( | ) |
prints the module configuration by looking at #defines Eventually this might be an object returned letting the code know a capability is included for runtime (vs compile time) decisions
Module Configuration
[x] ESP_M5
8.16.25 MQTT [x] USE_MQTT_NETWORKING
8.16.25 BLE SERVER [x] USE_BLE_SERVER_NETWORKING
8.16.25 BLE CLIENT [x] USE_BLE_CLIENT_NETWORKING
8.16.25 WIFI AP [x] USE_WIFI_AP_MODULE
and print any preferences to show
Definition at line 1681 of file MainModule.cpp.


| void main_saveWIFICredentials | ( | char * | ssid, |
| char * | ssid_password | ||
| ) |
save the WIFI credential
store the JSON version of these credentials..
look for an non matching slot.. if none, then use the first
jump out of loop if no match.. so index is valid, or NONE (which is the placeholder)
save in chosen index
Definition at line 937 of file MainModule.cpp.


| void main_setScannedDeviceName | ( | char * | deviceName | ) |
set the scanned device name
Definition at line 1007 of file MainModule.cpp.

| void main_setScannedGroupName | ( | char * | groupName | ) |
set the scanned group name 1.7.24
Definition at line 1015 of file MainModule.cpp.


| 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 (below, maybe in future a register approach) to decide who needs to know
sets the WIFI and MQTT user/password. It's up to the code to decide who needs to know (currently this calls APmodule..)
store the device name
store the JSON version of these credentials..
8.16.25 WIFI AP
Definition at line 1041 of file MainModule.cpp.


| boolean matchesSMMode_mainModule | ( | char * | cmd, |
| int | whichSMMode | ||
| ) |
returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn
Definition at line 2879 of file MainModule.cpp.

| int maxMenuModes_mainModule | ( | ) |
returns the current max of the menu modes (using the setting of min or expanded) to determine
Definition at line 2914 of file MainModule.cpp.


| void messageSend_mainModule | ( | char * | sendValue, |
| boolean | deviceNameSpecified | ||
| ) |
TODO: have a callback regist approach.
12.28.23, 8.28.23 Adding a way for others to get informed on messages that arrive for the set,val 5.21.25 SEND and CMD will be treated the same and put to "send"
5.21.25 this will overlap with the "cmd" .. so send == cmd
5.6.25 use object version
Definition at line 582 of file MainModule.cpp.


| void messageSetVal_mainModule | ( | char * | setName, |
| char * | valValue, | ||
| boolean | deviceNameSpecified | ||
| ) |
8.28.23 Adding a way for others to get informed on messages that arrive for the set,val 1.10.24 if deviceNameSpecified then this matches this device, otherwise for all. It's up to the receiver to decide if it has to be specified
5.6.25 use object version
Definition at line 560 of file MainModule.cpp.


| int minMenuModesMax_mainModule | ( | ) |
returns the current max of the MIN menu modes (using the setting of min or expanded) to determine
Definition at line 2908 of file MainModule.cpp.

| void onBLEServerCallback | ( | char * | message | ) |
The callback for "onWrite" of the bluetooth "onWrite'.
Definition at line 652 of file MainModule.cpp.
| void onStatusMessageBLEServerCallback | ( | char * | message | ) |
The callback for "status messages" of the bluetooth.
** The callback for "status messages" of the bluetooth
2.2.22 send this over bluetooth.. TODO.
Definition at line 659 of file MainModule.cpp.

| void onWriteBLEServerCallback | ( | char * | message | ) |
The callback for "onWrite" of the bluetooth "onWrite'.
send an async call with a string parameter. This will set store the value and then async call the command (passing the parameter) These are the ASYNC_CALL_PARAMETERS_MAX
Definition at line 756 of file MainModule.cpp.


| void onWriteBLEServerCallbackFinish | ( | char * | message | ) |
The FINISH of callback for "onWrite" of the bluetooth "onWrite'.
client never sends these wrapped messages of length 1, so process normally.. gets us out of potential infinite wait
we are done.. send big message to ourself..
Issue: the message is arriving via BLE, but if we call the MQTT process, it might call us back to send the message over BLE. This hangs things up! So short optimization for 'feed' will be to look for cmd and feed in message {cmd:feed} 8.19.22 issue #162
8.16.25 MQTT
the MQTTNetwork.processJSONMessage() will return true if the message was JSON and was processes, false otherwise.
processed by the MQTTNetworking code.. 8.16.25 BLE SERVER
perform feed...
look for ** sensor commands..
8.16.25 BLE SERVER
Definition at line 668 of file MainModule.cpp.


| void poweroff_mainModule | ( | ) |
power off
Definition at line 860 of file MainModule.cpp.

| void processClientCommandChar_mainModule | ( | char | cmd | ) |
single character version of processClientCommand (since many used that already)
Keep ProcessClientCmd short to let the callback run. instead change the feeder state flag processes a message that might save in the EPROM.. the cmd is still passed onto other (like the stepper module)
the sentToStepper is only needed if there are 'actions' on the command, versus just setting persistent EPROM data. Like feed, buzzer, etc.. Thus we don't need to know much of their implementation.. or we just pass anyway!
only process things that are stored persistently.. 7.20.25 6 months T Using switch to guarentee unique case of single characters
start timer..
start timer..
Issue #332 8.17.2024
set autoRotoate as well..
default to clockwise == 0 8.18.24 setting this will check for the factory setting..
Issue #332 8.17.2024
8.18.24 setting this will check for the factory setting..
Issue #332 8.17.2024
set autoRotoate as well..
set autoRotoate as well.. 8.18.24 setting this will check for the factory setting..
dispatches a call to the command specified. This is run on the next loop()
6.20.25
dispatches a call to the command specified. This is run on the next loop()
8.16.25 MQTT send to ourself
NOTE: the gateway is auto selected for now. A future version might manually set it in other situations (eg. my iPhone app should have a flag to not be a gateway at time)
7.25.25 chilly morning, Mt starting to come out. SPIFF
clean SPIFF file" upload SPIFF to web number of lines to send TODO: configure thie number of lines to save.. Restarts (or attempts) a restart of the WIFI using the existing credentials – vs the 'n' command 7.24.25 use SPIFF toggle spiff on/off WIFI credential changes... These are the ASYNC_CALL_PARAMETERS_MAX NOTE: this is almost the same as 'w' except there might be more WIFI than 2 (so swap is different). 8.16.24 per #332 8.16.24 per #332 NOTE: no current mode to specify CCW or CW dynamically (non factory reset) 9.30.23 reverse direction note: reboot not needed as the next time a feed happens, it reads this value if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined). if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined). poweroff 7.12.25 0 == Clear SENSOR definitions poweroff reboot .. so the sensors are set.. 7.9.25 1 == Init SENSOR definitions poweroff 7.30.25 changing to the HDriver's board 7.31.25 if Scanner or QR then pin 22 used .. so make M5HDriver (basically don't have a sensor) also specify the sensor plug 1 second motor (overloads "angle" field) set tumbler set autoRotoate as well.. tumbler reboot .. so the sensors are set.. 7.12.25 2 == default for SMART Button poweroff 7.30.25 changing to the HDriver's board 7.31.25 if Scanner or QR then pin 22 used .. so make M5HDriver (basically don't have a sensor) also specify the sensor plug 1 second motor (overloads "angle" field) This is the RPM speed
set autoRotoate as well..
tumbler
reboot .. so the sensors are set..
7.19.25 add Clear Sensors
poweroff
7.30.25 changing to the HDriver's board
7.31.25 if Scanner or QR then pin 22 used .. so make M5HDriver (basically don't have a sensor)
also specify the sensor plug
for Tumbler .. use 200
set autoRotoate as well..
tumbler
reboot .. so the sensors are set..
7.19.25 BLE Client ON
poweroff
7.30.25 changing to the HDriver's board
7.31.25 if Scanner or QR then pin 22 used .. so make M5HDriver (basically don't have a sensor)
also specify the sensor plug
reboot .. so the sensors are set..
7.9.25 grabbed from BOOTSTRAP let someone update the atom to the recent OTA
8.16.25 MQTT retrieves from constant location
7.9.25 grabbed from BOOTSTRAP let someone update the atom to the recent OTA
8.16.25 MQTT retrieves from constant location
8.16.25 MQTT retrieves from constant location
8.18.25
7.30.25 changing to the HDriver's board
7.31.25 if Scanner or QR then pin 22 used .. so make M5HDriver (basically don't have a sensor)
also specify the sensor plug
reboot .. so the sensors are set..
8.18.25 M5Clicker
8.16.25 MQTT retrieves from constant location
8.16.25 MQTT send to ourself
returns if the BLEClient is turned on.. note, if connected to a BLE device, then disconnect
toggle spiff on/off
6.20.25
print out stuff
Definition at line 2243 of file MainModule.cpp.


| 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..
8.2.24
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..
Definition at line 539 of file PreferencesController.cpp.


| void rebootDevice_mainModule | ( | ) |
power of devices reboot
Definition at line 853 of file MainModule.cpp.

| void refreshDelayButtonTouched_MainModule | ( | ) |
called by the feed operation to say the device is still running.. and count it as a button click.
called by the feed operation to say the device is still running.. and count it as a button click. Issue #145 8.8.22
Definition at line 773 of file MainModule.cpp.

| void registerCallbackMain | ( | int | callbacksModuleId, |
| int | callbackType, | ||
| void(*)(char *) | callback | ||
| ) |
register the callback based on the callbackType. use the callbacksModuleId for which one..
Definition at line 512 of file MainModule.cpp.


| void registerPinUse_mainModule | ( | long | pin, |
| String | pinName, | ||
| String | moduleName, | ||
| boolean | isI2C | ||
| ) |
7.31.25 store this information.. for STATUS 5.3.25 add a central clearing house for defining PIN use
5.3.25 create storage here
store globally
increment
Definition at line 3370 of file MainModule.cpp.

| void resetFeedCount_mainModule | ( | ) |
sets the feed count max
Definition at line 390 of file MainModule.cpp.
| void restartAllMenuStates_mainModule | ( | ) |
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
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
Definition at line 3320 of file MainModule.cpp.


| void restartProcessesForOTAUpdate_mainModule | ( | ) |
restart all loops... while OTA working..
Definition at line 152 of file MainModule.cpp.

| char * semanticMarkerToJSON_mainModule | ( | char * | semanticMarker | ) |
3.23.25 rainy weekend create a JSON string from the SemanticMarker https://semanticmarker.org/bot/setdevice/scott@konacurrents.com/PASS/M5AtomSocket/socket/on} Create a JSON knowing the "bot" syntax, eg. setdevice/USER/PASS/device/<set>/<flag> defined in TokenParser.h
Definition at line 3340 of file MainModule.cpp.


| void sendMessageString_mainModule | ( | char * | messageString | ) |
adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time}
Definition at line 1907 of file MainModule.cpp.


| void sendMessageStringTopic_mainModule | ( | char * | messageString, |
| char * | topicString | ||
| ) |
adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time}
8.16.25 MQTT
12.19.23 Amber in air from Iceland. 50 years since Dead 12.19.73
NOTE: the # has to be there, otherwise the sendMessageMQTT ignores it..
send this message over MQTT
Definition at line 1932 of file MainModule.cpp.


| void sendSemanticMarkerDocFollow_mainModule | ( | const char * | SMDocFollowAddress | ) |
sends the SM on the DOCFOLLOW channel (publish it..)
8.16.25 MQTT
Definition at line 2203 of file MainModule.cpp.


| void sendStatusMQTT_mainModule | ( | ) |
1.1.24 send status of this device after events..
TODO: have a callback regist approach.
Definition at line 3327 of file MainModule.cpp.


| void setAsyncCallOTAUpdate | ( | bool | flag | ) |
sets the async OTA flag (for next loop)
Definition at line 788 of file MainModule.cpp.
| void setClockwiseMotorDirection_mainModule | ( | boolean | isClockwiseFlag | ) |
8.18.24 setting this will check for the factory setting..
toggle flag and save as that mode..
this says: factory is CW and we want to turn CCW so we have to go the opposite direction (!CW)
toggle flag as well,
this says: factory is CCW and we want to turn CW so we have to go the opposite direction (!CW)
set to what it thinks it is...
Definition at line 2210 of file MainModule.cpp.


| void setConnectedBLEDevice_mainModule | ( | char * | deviceName, |
| boolean | isGEN3 | ||
| ) |
BLE Discovery Methods Connected to a BLE device with the advertised name. The syntax can include (PTFeeder:NAME) or just PTFeeder Being disconnected is already a flag isConnectedBLE ...
set the isGEN3 flag
now set the gateway based on if GEN3
seems device name = "Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead Note: the Address, eg "7c:9e:bd:48:af:92" is unique somehow.. lets use that to skip one.. parse out the 2nd half of name go past the : empty name (just PTFeeder) 8.29.23 send a message saying we connected.. parse for the address too.. strcpy(_fullBLEDeviceName, deviceName); seems device name = "Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead Note: the Address, eg "7c:9e:bd:48:af:92" is unique somehow.. lets use that to skip one..
parse out the 2nd half of name
empty name (just PTFeeder)
Definition at line 2989 of file MainModule.cpp.


| void setCurrentSMMode_mainModule | ( | int | whichSMMode | ) |
sets the current screen mode .. which can be used by Button and Display processing
This is needed now as message from external (not button pressing) causes a state change, but the button processing isn't knowing about it... sets the current screen mode .. which can be used by Button and Display processing whichSMMode 0..SM_LAST
Definition at line 2926 of file MainModule.cpp.


| void setLUXThreshold_mainModule | ( | int | thresholdKind, |
| int | luxVal | ||
| ) |
set the threshold val
Definition at line 1555 of file MainModule.cpp.

| void setSemanticMarkerDocFollow_mainModule | ( | char * | SMDocFollowAddress | ) |
sed the address to follow
SemanticMarker events This would see a DOCFollow message, and set the value.. then SM10 can display it..
Definition at line 2189 of file MainModule.cpp.
| void setup_mainModule | ( | ) |
called from the setup()
THIS IS the setup() and loop() but using the "component" name, eg MQTTNetworking() This will perform preference initializtion as well called from the setup()
setup for the token parser (really just for testing) – an
init globals like strings (but nothing that needs preferences)
read the preferences from EPROM
must initialize the structs NOTE: this has to ber AFTER the preferences are read in..
a first time feature .. to get EPROM changed to a different default
7.12.22 {'dev':'m5",'cmd':'bleserveron'} or bleserveroff will work later.. #issue 116 .. turn off the BLE_Server for the M5
5.6.25 use object version
all ..
5.14.25 use the Sensor types first we have N sensors then we get which ones the user wants (the SENSORS_SETTING) then we instantiate, and provide ping, etc.
Definition at line 211 of file MainModule.cpp.


| void setup_Sensors_mainModule | ( | ) |
1.22.24 setup of buttons
setup of buttons and sensors
these are the plugin modules .. and only 1 active at a time except for ATOM
5.6.25 use the M5Atom ClassType
7.17.25
8.16.25 bring in the Camera
3.31.25 create array of plugs
7.17.25
8.16.25 bring in the Camera
add check..
use this one...
find the current atomKind. which is a string
find which one..
check against the identity.. (or make this part of that method?)
Matched..
now the setup() call
5.6.25 use object version
Definition at line 3156 of file MainModule.cpp.


| void showText_mainModule | ( | String | text | ) |
shows a FEED (or whatever) then blanks the screen after N seconds NOTE: This will be a scrolling text as sometime ..
Definition at line 1658 of file MainModule.cpp.


| void singleClickTouched | ( | char * | whichButton | ) |
called on single click NOTE: with BLE_CLIENT_NETWORKING, the right button and top button send a BLE command for feeding..
8.16.25 WIFI AP for now, only send the FEED command via BLE_CLIENT if turned on. No reboot to AP mode yet.. 8.16.25 BLE CLIENT send the async FEED
dispatches a call to the command specified. This is run on the next loop()
Definition at line 1645 of file MainModule.cpp.


| void solidLightMessageCallback | ( | char * | message | ) |
callback for SOLID blinking led
Definition at line 1618 of file MainModule.cpp.


| void solidLightOnOff | ( | boolean | onOff | ) |
callback for SOLID blinking led
supports turning on the solid light..
Definition at line 1666 of file MainModule.cpp.


| boolean startsWithChar | ( | char * | str, |
| char | c | ||
| ) |
a char* version of startsWith (after skipping spaces)
find first non space character, and if not '{' then return false
jump out if not a space, and 'i' will be the thing to look for
Definition at line 1855 of file MainModule.cpp.

| boolean stopAllProcesses_mainModule | ( | ) |
if stopped
try to disconnect..
Definition at line 157 of file MainModule.cpp.

| void stopMotor_mainModule | ( | ) |
added 9.29.22 to support wildcards #196
6.7.25 hot air balloons over house.. stops the motor
Definition at line 117 of file MainModule.cpp.


| void stopProcessesForOTAUpdate_mainModule | ( | ) |
stop all loops... while OTA working..
Definition at line 147 of file MainModule.cpp.

| void toggleMinimalMenuMode_mainModule | ( | ) |
toggles the menu mode
Definition at line 2902 of file MainModule.cpp.

| M5AtomClassType * whichM5AtomClassType | ( | ) |
6.6.25 get the current M5AtomClassType
Definition at line 3117 of file MainModule.cpp.
| int whichSMMode_mainModule | ( | char * | cmd | ) |
************** SM Mode Processing ***************
returns an index from 0..max of SM matching cmd, or -1 if none
Definition at line 2853 of file MainModule.cpp.

| callbackSignature* _allCallbacks[CALLBACKS_MODULE_MAX] |
array of known size (CALLBACKS_MODULE_MAX) of callbackSignatures
Definition at line 476 of file MainModule.cpp.
| boolean _asyncCallFlags[ASYNC_CALL_MAX] |
storage for asyncCallCommands
3.21.22 these are to setup for the next time the main loop() runs to call these commands.. The implementation is hard coded in the ESP_IO.ino TODO: make this a registeration approach
Definition at line 1096 of file MainModule.cpp.
| boolean _asyncCallFlagsParameters[ASYNC_CALL_PARAMETERS_MAX] |
array of async flags for the different ASYNC_CALl values
Definition at line 1098 of file MainModule.cpp.
| boolean _asyncCallOTAUpdateFlag = false |
3.28.22 .. implemented in ESP_IOT.ino
Definition at line 781 of file MainModule.cpp.
| char _asyncParameter[500] |
the parameter being sent to those commands passing an argument
Definition at line 167 of file MainModule.cpp.
| char _bigMessage[500] |
Definition at line 182 of file MainModule.cpp.
| BuzzerSensorClass* _BuzzerSensorClass |
Definition at line 64 of file MainModule.cpp.
| int _callbacksFunctionsMAXS[CALLBACKS_MODULE_MAX] |
the array of callback functions
the max of each module .. hard coded (or 0 if module not there)
Definition at line 455 of file MainModule.cpp.
| boolean _callbacksInitializedMain = false |
flag for initializing if not yes
Definition at line 458 of file MainModule.cpp.
| uint32_t _chipID_MainModule = 0 |
3.17.24 the unqiue chip id
Definition at line 1522 of file MainModule.cpp.
| char _chipIdString_MainModule[15] |
string like: 10311304
Definition at line 1524 of file MainModule.cpp.
| boolean _connecteBLEisGEN3 = false |
whether connected GEN3
Definition at line 2979 of file MainModule.cpp.
| char _connectedBLEDeviceAddress[50] |
full: ""Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead"
Definition at line 188 of file MainModule.cpp.
| char _connectedBLEDeviceName[50] |
saved BLE connected name 8.26.22
Definition at line 184 of file MainModule.cpp.
| char _deviceNameSave[50] |
saved deviceName storage..
Definition at line 178 of file MainModule.cpp.
| int _feedCount_mainModule = 0 |
5.3.22 added a feed count approach.. (NOTE: there is a _feedCount in Dispence.cpp ... and no linker error!!! )
Definition at line 335 of file MainModule.cpp.
| char _fullBLEDeviceName[100] |
full: ""Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead"
Definition at line 186 of file MainModule.cpp.
| char _fullStatusString[500] |
status string (URL query format)
Definition at line 174 of file MainModule.cpp.
| char _groupTopicName[100] |
storage for the group topic name Note NO "/" in the front of the path only "usersP"
Definition at line 1584 of file MainModule.cpp.
| char _JSONStringForWIFICredentials[200] |
global to store credentials when ever they are stored..
Definition at line 169 of file MainModule.cpp.
| KeyUnitSensorClass* _KeyUnitSensorClass |
Definition at line 65 of file MainModule.cpp.
| char* _lastSemanticMarkerDocFollow = NULL |
SemanticMarker events This would see a DOCFollow message, and set the value.. then SM10 can display it..
Definition at line 2187 of file MainModule.cpp.
| M5Atom_CameraModuleClass* _M5Atom_CameraModuleClass |
8.16.25 bring in the CameraModule from 2022 6
Definition at line 42 of file MainModule.cpp.
| M5Atom_Core2ModuleClass* _M5Atom_Core2ModuleClass |
Definition at line 36 of file MainModule.cpp.
| M5Atom_HDriverModuleClass* _M5Atom_HDriverModuleClass |
Definition at line 34 of file MainModule.cpp.
| M5Atom_QRCodeModuleClass* _M5Atom_QRCodeModuleClass |
Definition at line 32 of file MainModule.cpp.
| M5Atom_SocketModuleClass* _M5Atom_SocketModuleClass |
5.6.25 use the M5Atom ClassType
Definition at line 30 of file MainModule.cpp.
| M5Atom_TinyGPSModuleClass* _M5Atom_TinyGPSModuleClass |
7.17.25 - Adding GPS 5
Definition at line 39 of file MainModule.cpp.
| M5AtomClassType* _M5AtomClassTypes[NUM_M5ATOM_CLASS] |
3.31.25 create array of plugs
Definition at line 49 of file MainModule.cpp.
| char _messageStorage[MESSAGE_STORAGE_MAX] |
Definition at line 172 of file MainModule.cpp.
| char* _MQTT_Password = (char*)"" |
12.14.23
Definition at line 981 of file MainModule.cpp.
| char* _MQTT_Username = (char*)"" |
Definition at line 982 of file MainModule.cpp.
| char* _OFF_LIGHT = (char*)"OFF" |
Definition at line 1595 of file MainModule.cpp.
| char* _ON_LIGHT = (char*)"ON" |
Definition at line 1594 of file MainModule.cpp.
| PinUseStruct _pinUseStruct |
7.31.25 add this for a status, saw that QRCode was using 22 also .. so buzer didn't work.
#define PIN_USE_MAX 10 struct pinUseStruct { int pinUseCount; char *pinUseArray[PIN_USE_MAX]; } _pinUseStruct; global for use
Definition at line 3356 of file MainModule.cpp.
| int _saveWhichSMMode = 0 |
the saved SMMode
Definition at line 2924 of file MainModule.cpp.
| char _scannedDeviceName[100] |
Definition at line 983 of file MainModule.cpp.
| char _scannedGroupTopicName[100] |
Definition at line 984 of file MainModule.cpp.
| char _serialBuffer[300] |
storage for reading from the serial buffer 6.20.25 (Sam Sprague grad Western party)
Definition at line 275 of file MainModule.cpp.
| char _smMode_MainModule[10] |
current smMode
Definition at line 176 of file MainModule.cpp.
| boolean _stopAllProcessing = false |
testing..
Definition at line 145 of file MainModule.cpp.
| int _thresholdLUXDark = 80 |
1.12.24 add a temporary LUX dark threshholdKind = 0 (LIGHT), 1=(DARK) .. others might be 2=super dark
Definition at line 1552 of file MainModule.cpp.
| int _thresholdLUXLight = 0 |
Definition at line 1553 of file MainModule.cpp.
| boolean _waitingForBigMessageEnd = false |
store a big message #MSG_START .. #MSG_END
Definition at line 181 of file MainModule.cpp.
| M5AtomClassType* _whichM5AtomClassType |
use this one...
Definition at line 52 of file MainModule.cpp.