2#include "../../Defines.h"
5#define USE_NEW_M5ATOMCLASS
7#ifdef USE_NEW_M5ATOMCLASS
9#include "../M5AtomClassModule/M5AtomClassType.h"
11#include "../M5AtomClassModule/M5Atom_SocketModuleClass.h"
12#include "../M5AtomClassModule/M5Atom_QRCodeModuleClass.h"
13#include "../M5AtomClassModule/M5Atom_HDriverModuleClass.h"
15#include "../M5AtomClassModule/M5Atom_Core2ModuleClass.h"
17#include "../M5AtomClassModule/M5Atom_TinyGPSModuleClass.h"
19#include "../M5AtomClassModule/M5Atom_CameraModuleClass.h"
22#include "../M5AtomClassModule/M5Atom_NoModuleClass.h"
27#include "../ATOM_LED_Module/M5Display.h"
30#pragma mark BUTTON Processing of M5
50#pragma mark M5AtomClassType
73#define NUM_M5ATOM_CLASS 7
83#pragma mark SensorClassType
88#define USE_SENSOR_CLASS
93#define USE_SENSOR_CLASS
95#ifdef USE_SENSOR_CLASS
97#include "../SensorClass/SensorClassType.h"
98#include "../SensorClass/BuzzerSensorClass.h"
99#include "../SensorClass/KeyUnitSensorClass.h"
101#include "../SensorClass/PIRSensorClass.h"
104#include "../SensorClass/ChainButtonClassType.h"
106#define NUM_SENSOR_CLASS_TYPES 4
144 for (
int i=0; i< count; i++)
182 for (
int i=0; i< count; i++)
207 SerialDebug.println(
" *** initSensorClassTypeArray ***");
222 int whichSensorClassIndex = 0;
223 SerialDebug.println(
"setup_SensorClassIypes");
235 SerialDebug.printf(
"**** sensors are more than max .. FIX CODE");
237 SerialDebug.printf(
"Created %d SensorClassTypes\n", whichSensorClassIndex);
251 for (
int i=0; i< count; i++)
254 SerialDebug.printf(
"Looking for sensor: %s, %ld, %ld\n", sensor->
sensorName, sensor->
pin1, sensor->
pin2);
257 boolean foundMatchingClassType =
false;
262 char *sensorIdentity = whichSensorClassType->
classIdentity();
263 if (strcmp(sensor->
sensorName, sensorIdentity)==0)
273 SerialTemp.printf(
"sensor.setup(%s) = %d\n", whichSensorClassType->
classIdentity(), whichSensorClassType);
276 whichSensorClassType->
setup();
278 foundMatchingClassType =
true;
283 if (!foundMatchingClassType)
285 SerialDebug.printf(
"Missing SensorClass definition: %s\n", sensor->
sensorName);
291 for (
int i=0; i< count; i++)
297 SerialDebug.printf(
"Missing class definition: %s\n", sensor->
sensorName);
302 SerialDebug.println(
"Finish initSensorClassTypeArray");
339 return MAIN_BLE_SERVER_SERVICE_NAME_PTFeeder;
341 return MAIN_BLE_SERVER_SERVICE_NAME_PTClicker;
372#define MESSAGE_STORAGE_MAX 500
414 SerialMin.println(
"setup_mainModule");
430#ifdef BOOTSTRAP_CLEAN
434#define TEMP_FIX_LOOP_NO
459 SerialMin.println(
"FIRST TIME TURNING off the BLE_SERVER for the M5");
481#ifdef USE_SENSOR_CLASS
489#define TRY_DUPLICATES_works
497 SerialError.println(
"*** invalidPins testing..");
502 SerialDebug.println(
"END setup_mainModule");
510 SerialDebug.print(
" **** ESP BEGIN: ");
511 SerialDebug.println(num);
518 SerialDebug.println(
" *** DONE M5.begin");
523 SerialLots.printf(
"***ESP UPDATE(%d)\n",num);
531#if defined(ESP_M5_CAMERA) || defined(ESP_32)
533int _mainLoopCounter = 0;
552#if defined(ESP_M5_CAMERA) || defined(ESP_32)
555 if (_mainLoopCounter++ > 30)
560 _mainLoopCounter = 0;
565#pragma mark Serial Input Processor
572 if (Serial.available())
575 String command = Serial.readStringUntil(
'\n');
577 SerialDebug.printf(
"** SerialCommand: '%s'\n", command);
581 if (command ==
"help")
583 SerialTemp.println(VERSION);
585 SerialDebug.println(
"Enter any Single Char or JSON msg, type '.' for commands");
586 SerialDebug.println(
"r -- reboot");
587 SerialDebug.println(
". -- shows single char commands");
588 SerialDebug.println(
"Example JSON to change WIFI (copy and modify with your values)");
589 SerialDebug.println(
" supports single quotes for values");
590 SerialDebug.println(
" Use to set your WIFI");
591 SerialDebug.println(
"{'ssid':'SunnyWhiteriver', 'ssidPassword':'sunny2021'}");
592 SerialDebug.println(
"{'ssid':'wes', 'ssidPassword':'wes'}");
593 SerialDebug.println();
599 else if (command ==
"r")
605 else if (command ==
"test1")
608 SerialDebug.println(
" **** TODO: OTA for test1");
611 else if (command ==
"test")
613 SerialDebug.println(
"create TEST user");
614 SerialDebug.println(
"{'ssid':'SunnyWhiteriver', 'ssidPassword':'sunny2021'}");
615 SerialDebug.println(
"{'ssid':'wes', 'ssidPassword':'wes'}");
632 char credentials[400];
634 "{'ssid':'SSID','ssidPassword':'PASS','mqtt_topic':'usersP/bar/test','mqtt_user':'test','deviceName':'M5Atomtest','mqtt_password':'test','mqtt_guestPassword':'test','uuid':'test','mqtt_port':'1883','mqtt_server':'idogwatch.com','location':'Seattle,Wa'}");
654 SerialDebug.println(
" *** only single character supported since BLE_Server off, type '#' to turn on");
662#pragma mark button processing
663#ifdef USE_BUTTON_MODULE
696#ifdef USE_SENSOR_CLASS
739 SerialTemp.println(
"incrementFeedCount_mainModule");
767 if (substring.length() == 0 )
769 bool found = strstr(&message[0], &substring[0]);
770 SerialLots.printf(
"containsSubstring-%d - %s in: %s\n", found, &substring[0], &message[0]);
775#include "../MQTTModule/MQTTNetworking.h"
778#include "../BLEServerModule/BLEServerNetworking.h"
781#include "../BLEClientModule/BLEClientNetworking.h"
782#ifdef USE_BUTTON_MODULE
783#include "../ButtonModule/ButtonProcessing.h"
789#define CALLBACKS_MQTT 0
790#define CALLBACKS_BUTTON_MODULE 1
791#define CALLBACKS_BLE_CLIENT 2
792#define CALLBACKS_BLE_SERVER 3
798void callCallbackMain(
int callbacksModuleId,
int callbackType,
char *message);
803#define CALLBACKS_MAX_MQTT MQTT_MAX_CALLBACKS
804#define CALLBACKS_MAX_BUTTON_MODULE MAX_CALLBACKS_BM
805#define CALLBACKS_MAX_BLE_CLIENT BLE_CLIENT_MAX_CALLBACKS
806#define CALLBACKS_MAX_BLE_SERVER BLE_SERVER_MAX_CALLBACKS
812 SerialLots.printf(
"No callback defined .. %s\n", message);
836 SerialLots.printf(
"creatingCallbacks %d size: %d\n", max,
sizeof(
callbackSignature *));
838 for (
int i=0; i< max; i++)
842 return callbackArray;
866#ifdef USE_BUTTON_MODULE
883 SerialLots.printf(
"registerCallbackMain %d, %d\n", callbacksModuleId, callbackType);
889 if (callbackType < 0 || callbackType >= max)
891 SerialError.printf(
"#### Error outside callback range - 1, %d\n", callbackType);
906 if (callbackType < 0 || callbackType >= max)
908 SerialError.printf(
"#### Error outside callback range - 2, %d\n", callbackType);
912 void (*callbackFunction)(
char *) =
_allCallbacks[callbacksModuleId][callbackType];
913 (*callbackFunction)(message);
920 return valCmdString.equalsIgnoreCase(
"on") ||
921 valCmdString.equalsIgnoreCase(
"1") ||
922 valCmdString.equalsIgnoreCase(
"true");
931 SerialTemp.printf(
"messageSetVal(%s,%s)\n", setName, valValue);
939#ifdef USE_SENSOR_CLASS
960#pragma mark USE_NEW_M5ATOMCLASS
979 SerialTemp.print(
"feedMessageCallback_main: ");
980 SerialTemp.println(message);
981 char * rxValue = (
char*)
"c";
998 SerialTemp.print(
"Paired Device: ");
1001 SerialTemp.printf(
"Gateway: Feeding over the BLE CLIENT network .. if connected: %d\n",
isConnectedBLEClient());
1007 SerialLots.println(
"after send feed via ble");
1010#ifdef TOO_MUCH_7_10_26
1012 SerialDebug.println(
"FEED now send STATUS");
1024 SerialDebug.println(
" *** main_credentialsUpdated .. setDoneWIFI_APModuleFlag **");
1034 SerialCall.print(
"onWriteBLEServerCallback: ");
1035 SerialCall.println(message);
1041 SerialCall.print(
"onStatusMessageBLEServerCallback");
1042 SerialCall.print(message);
1051 SerialDebug.print(
"onWriteBLEServerCallback_main: ");
1052 SerialDebug.println(message);
1056 if (strlen(message) == 1)
1059 if (strcmp(message,
"#MSG_START")==0)
1067 if (strcmp(message,
"#MSG_END")==0)
1089 message = (
char*)
"s";
1093 message = (
char*)
"B";
1097 message = (
char*)
"b";
1117 SerialDebug.printf(
"Perform BLE Command '%s'\n", message);
1119 char cmd = message[0];
1131 SerialDebug.println(
"*********");
1139#define TRY_ASYNC_BLE_PROCESSING
1140#ifdef TRY_ASYNC_BLE_PROCESSING
1155#ifdef USE_BUTTON_MODULE
1157 refreshDelayButtonTouched_ButtonProcessing();
1191 boolean isValid = pairedDevice && strlen(pairedDevice)>0 && strcmp(pairedDevice,
"NONE")!= 0;
1195 isValid = pairedDeviceAddress && strlen(pairedDeviceAddress)>0 && strcmp(pairedDeviceAddress,
"NONE")!= 0;
1196 SerialLots.printf(
"isValidDeviceAddress(%s,%d)\n", pairedDeviceAddress?pairedDeviceAddress:(
char*)
"NULL", isValid);
1198 SerialLots.printf(
"isValidPairedDevice_mainModule(%s,%d)\n", pairedDevice?pairedDevice:(
char*)
"NULL", isValid);
1208 if (pairedDevice && strlen(pairedDevice)>0 && strcmp(pairedDevice,
"NONE")!= 0)
1210 SerialLots.printf(
"getPairedDeviceOrAddress_mainModule(%s)\n", pairedDevice);
1211 return pairedDevice;
1214 if (pairedDeviceAddress && strlen(pairedDeviceAddress)>0 && strcmp(pairedDeviceAddress,
"NONE")!= 0)
1216 SerialLots.printf(
"getPairedDeviceOrAddress_mainModule(%s)\n", pairedDeviceAddress);
1217 return pairedDeviceAddress;
1244 SerialTemp.println(
" **** POWEROFF ***");
1246#ifndef ESP_M5_CAMERA
1247#ifndef M5STICKCPLUS2
1249#ifndef ESP_M5_ATOM_S3
1267 SerialDebug.println(
"CLEANING EPROM PREFERENCES");
1280 SerialDebug.println(
"REBOOTING...");
1306 if (strcmp(credential,
"NONE")==0)
1310 SerialTemp.print(
"main_nextJSONWIFICredential:");
1311 SerialTemp.println(credential);
1316 SerialTemp.print(
"main_nextJSONWIFICredential:");
1326 SerialMin.print(
"main_saveWIFICredentials");
1335 if (strcmp(credential,
"NONE")==0)
1354 SerialMin.println(
"main_cleanSavedWIFICredentials");
1395 SerialDebug.printf(
"main_setScannedDeviceName(%s)\n", deviceName);
1402 SerialDebug.printf(
"main_setScannedGroupName(%s)\n", groupName);
1404 if (groupName && strlen(groupName)>0)
1426void main_updateMQTTInfo(
char *ssid,
char *ssid_password,
char *username,
char *password,
char *guestPassword,
char *deviceName,
char * host,
char * port,
char *locationString)
1428 SerialMin.printf(
"main_updateMQTTInfo(%s,%s,%s,%s,%s, %s, d=%s)\n", ssid?ssid:
"NULL", ssid_password?ssid_password:
"", username?username:
"NULL", password?password:
"NULL", guestPassword?guestPassword:
"NULL", locationString?locationString:
"NULL", deviceName?deviceName:
"NULL");
1450 switch (syncCallCommand)
1467 SerialDebug.println(
"NO BuzzerSensorClass defined ..turn off");
1513 SerialError.printf(
"ERROR: async call out of range: %d\n", asyncCallCommand);
1518 SerialTemp.printf(
"1.main_dispatchAsyncCommand: %d\n", asyncCallCommand);
1533 SerialError.printf(
"ERROR: async call out of range: %d\n", asyncCallCommand);
1538 SerialTemp.print(
"2.main_dispatchAsyncCommandWithString:");
1539 SerialTemp.print(asyncCallCommand);
1540 SerialTemp.print(
": ");
1549 SerialDebug.println(
"SYNC_REBOOT");
1565 SerialTemp.printf(
"invokeAsyncCommands(%d)\n", i);
1570 SerialTemp.print(
"ASYNC_CALL_BLE_CLIENT_PARAMETER: ");
1580 SerialTemp.print(
"ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER: ");
1588 char httpAddress[100];
1596 if (thirdSlash == 3)
1601 hostname[i] = (char)0;
1603 strcpy(httpAddress,a);
1608 SerialTemp.print(
"will performOTAUpdate: ");
1609 SerialTemp.print(hostname);
1610 SerialTemp.print(
" with httpAddress: ");
1611 SerialTemp.println(httpAddress);
1618 SerialDebug.print(
"ASYNC_JSON_MESSAGE_PARAMETER: ");
1630 SerialDebug.print(
"ASYNC_JSON_MQTT_MESSAGE_PARAMETER: ");
1647 SerialDebug.print(
"ASYNC_REST_CALL_MESSAGE_PARAMETER: ");
1649#ifdef USE_REST_MESSAGING
1669 SerialLots.println(
"ASYNC_CALL_OTA_UPDATE");
1674 SerialTemp.println(
"ASYNC_CALL_CLEAN_CREDENTIALS");
1680 SerialTemp.println(
"ASYNC_CALL_CLEAN_EPROM");
1684 SerialLots.println(
"ASYNC_CALL_FEED_COMMAND");
1692 SerialTemp.println(
"ASYNC_SEND_MQTT_FEED_MESSAGE");
1694 SerialCall.println(
"async_send_feed.1");
1702 char pubString[100];
1704 boolean isPaired = paired && strlen(paired)>0;
1706 SerialTemp.printf(
"Paired = %s\n", paired?paired:(
char*)
"none");
1715 strcat(pubString,
",'cmd':'feed'}");
1735 SerialTemp.println(
" *** NO BLE connected so send wifi ASYNC_SEND_MQTT_FEED_MESSAGE");
1740 SerialCall.println(
"async_send_feed.2");
1766 SerialTemp.println(
"ASYNC_CLICK_SOUND");
1778 SerialDebug.printf(
"ASYNC_CALL_BUZZ %d\n",isBuzzOn);
1782 cmdToSend =
"{'cmd':'buzzon'}";
1787 cmdToSend =
"{'cmd':'buzzoff'}";
1798 SerialLots.println(
"async_call_buzz_on/off -- not BLE connected.. send MQTT");
1814 SerialLots.println(
"async_call_buzz_on -- not BLE connected.. send MQTT");
1821 SerialLots.println(
"async_call_buzz_on -- YES BLE connected.. send BLE");
1833 SerialLots.println(
"ASYNC_SET_GATEWAY_ON");
1839 SerialLots.println(
"ASYNC_SET_GATEWAY_OFF");
1845 SerialDebug.println(
"ASYNC_REBOOT");
1851 SerialDebug.println(
"ASYNC_POWEROFF");
1856 SerialDebug.println(
"ASYNC_BLANKSCREEN");
1868 SerialDebug.print(
" ASYNC_SEND_MQTT_STATUS_URL: ");
1869 SerialDebug.println(statusURL);
1873#ifdef M5BUTTON_MODULE
1877 statusM5ButtonModule();
1902 SerialLots.printf(
"NO COMMAND: %s", i);
1910#ifdef M5BUTTON_MODULE
1911 SerialDebug.println(
"changeButtonColor_MainModule");
1927 for (
int i = 0; i < 17; i = i + 8) {
1952 switch (thresholdKind)
1965 switch (thresholdKind)
1980#define GROUP_TOPIC_TO_SEND (char*)"usersP/groups"
2020 SerialLots.println(
"solidLightMessageCallback..");
2025 boolean lightOn =
true;
2026 lightOn = strstr(&message[0],
_ON_LIGHT);
2070 SerialLots.println(
"solidLight..");
2073 boolean lightOn = onOff;
2084 SerialDebug.println(
" ** #define Module Configuration **");
2085 SerialDebug.println(PARTITION_SCHEME);
2086 SerialDebug.printf(
"M5Stack Version = %s\n", (
char*)M5STACK_VERSION);
2088 SerialDebug.println(
" ** BUILDS **");
2092 SerialMin.println(
"[x] ESP_M5");
2094 SerialMin.println(
"[ ] ESP_M5");
2098 SerialMin.println(
"[x] ESP_M5_CAMERA");
2100 SerialMin.println(
"[ ] ESP_M5_CAMERA");
2104 SerialMin.println(
"[x] ESP_32");
2106 SerialMin.println(
"[ ] ESP_32");
2108#ifdef M5CORE2_MODULE
2110 SerialMin.println(F(
"[x] M5CORE2_MODULE"));
2112 SerialMin.println(F(
"[ ] M5CORE2_MODULE"));
2115#ifdef ESP_M5_SMART_CLICKER_CONFIGURATION
2116 SerialMin.println(F(
"[x] ESP_M5_SMART_CLICKER_CONFIGURATION"));
2118 SerialMin.println(F(
"[ ] ESP_M5_SMART_CLICKER_CONFIGURATION"));
2121#ifdef ESP_M5_ATOM_S3
2122 SerialMin.println(F(
"[x] ESP_M5_ATOM_S3"));
2124#ifdef ESP_M5_ATOM_LITE
2125 SerialMin.println(F(
"[x] ESP_M5_ATOM_LITE"));
2127 SerialMin.println(F(
"[ ] ESP_M5_ATOM_LITE"));
2130 SerialDebug.println(F(
" ** MQTT BLE NETWORKING **"));
2134 SerialMin.println(
"[x] USE_MQTT_NETWORKING");
2138 SerialMin.println(
"[x] USE_BLE_SERVER_NETWORKING");
2142 SerialMin.println(F(
"[x] USE_BLE_CLIENT_NETWORKING"));
2147 SerialMin.println(F(
"[x] USE_WIFI_AP_MODULE"));
2150#ifdef USE_BUTTON_MODULE
2152 SerialMin.println(
"[x] USE_BUTTON_MODULE");
2154 SerialMin.println(
"[ ] USE_BUTTON_MODULE");
2157#ifdef M5BUTTON_MODULE
2159 SerialMin.println(
"[x] M5BUTTON_MODULE");
2161 SerialMin.println(
"[ ] M5BUTTON_MODULE");
2165#ifdef USE_STEPPER_MODULE
2166 SerialMin.println(
"[x] USE_STEPPER_MODULE");
2168 SerialMin.println(
"[ ] USE_STEPPER_MODULE");
2172 SerialMin.println(
"[x] USE_UI_MODULE");
2174 SerialMin.println(
"[ ] USE_UI_MODULE");
2177#ifdef USE_DISPLAY_MODULE
2178 SerialMin.println(
"[x] USE_DISPLAY_MODULE");
2180 SerialMin.println(
"[ ] USE_DISPLAY_MODULE");
2184 SerialMin.println(F(
"[x] BOARD"));
2186 SerialMin.println(F(
"[ ] BOARD"));
2188#ifdef USE_SPIFF_MODULE
2191 SerialMin.println(
"[ ] USE_SPIFF_MODULE");
2193#ifdef USE_SPIFF_MQTT_SETTING
2196#ifdef USE_SPIFF_QRATOM_SETTING
2201 SerialMin.println(F(
"[x] USE_FAST_LED"));
2203 SerialMin.println(F(
"[ ] USE_FAST_LED"));
2205#ifdef KEY_UNIT_SENSOR_CLASS
2206 SerialMin.println(F(
"[x] KEY_UNIT_SENSOR_CLASS"));
2208 SerialMin.println(F(
"[ ] KEY_UNIT_SENSOR_CLASS"));
2210#ifdef USE_LED_BREATH
2211 SerialMin.println(F(
"[x] USE_LED_BREATH"));
2213 SerialMin.println(F(
"[ ] USE_LED_BREATH"));
2216#if (SERIAL_DEBUG_ERROR)
2217 SerialMin.println(F(
"[x] SERIAL_DEBUG_ERROR"));
2219#if (SERIAL_DEBUG_DEBUG)
2220 SerialMin.println(F(
"[x] SERIAL_DEBUG_DEBUG"));
2222#if (SERIAL_DEBUG_INFO)
2223 SerialMin.println(F(
"[x] SERIAL_DEBUG_INFO"));
2225#if (SERIAL_DEBUG_MINIMAL)
2226 SerialMin.println(F(
"[x] SERIAL_DEBUG_MINIMAL"));
2228#ifdef USE_LIB_WEBSERVER
2229 SerialMin.println(
"[x] USE_LIB_WEBSERVER");
2231 SerialMin.println(
"[ ] USE_LIB_WEBSERVER");
2242 return strdup(stringA);
2252 return strdup(stringA);
2264 else if (strlen(stringA) == 0)
2275 if (!str)
return false;
2278 while (i < strlen(str))
2295 float batVoltage = 1;
2296 float batPercentage = 100;
2298#ifndef M5STICKCPLUS2
2302#elif defined(M5CORE2_MODULE)
2304 batVoltage = M5.Axp.GetBatVoltage();
2305 batPercentage = (batVoltage < 3.2) ? 0 : ( batVoltage - 3.2 ) * 100;
2307 batVoltage = M5.Axp.GetBatVoltage();
2308 batPercentage = (batVoltage < 3.2) ? 0 : ( batVoltage - 3.2 ) * 100;
2312 uint16_t vbatData = M5.Axp.GetVbatData();
2313 double vbat = vbatData * 1.1 / 1000;
2314 batPercentage = 100.0 * ((vbat - 3.0) / (4.07 - 3.0));
2319 if (batPercentage > 100.0)
2320 batPercentage = 100.0;
2321 return batPercentage;
2335 SerialDebug.printf(
"sendMessageStringTopic_mainModule(%s) - topic=%s\n", messageString, topicString);
2336 if (strlen(messageString) > 0 && messageString[0] ==
'{')
2360#ifndef M5STICKCPLUS2
2361 M5.IMU.getTempData(&temperature);
2365#ifdef USER_THE_MAX_TEMP_FEATURE
2367 if (temperature > maxtemp)
2377 SerialTemp.println(
" *** This would poweroff .. but you can send message");
2384 float temperature = 10.0;
2386 return temperature ;
2430#pragma mark USE_NEW_M5ATOMCLASS
2436#ifdef M5CORE2_MODULE
2442 return (
char*)
"'tbd':'x'";
2454 sprintf(buf,
"&%s=%s", key, val);
2482#ifdef OVERLOADS_TIME_T
2510#ifdef NO_MORE_PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING
2550 sprintf(
_fullStatusString,
"status?T=%d&v=%s&dev=%s",time, VERSION_SHORT, deviceName);
2553#pragma mark USE_NEW_M5ATOMCLASS
2574void main_setStatusJSON(
const char* JSONString)
2579void main_setStatusKeyValue(
const char* key,
const char* value)
2613 SerialDebug.printf(
"factoryMotorClockwise = %d, isClockwiseFlag = %d\n",factoryMotorClockwise, isClockwiseFlag);
2615 if (factoryMotorClockwise && isClockwiseFlag)
2617 SerialDebug.println(
"setClockwiseMotorDirection -- same so no change");
2619 else if (factoryMotorClockwise && !isClockwiseFlag)
2622 isClockwiseFlag = !isClockwiseFlag;
2626 else if (!factoryMotorClockwise && isClockwiseFlag)
2629 isClockwiseFlag = !isClockwiseFlag;
2633 else if (!factoryMotorClockwise && !isClockwiseFlag)
2635 SerialDebug.println(
"setClockwiseMotorDirection -- same so no change");
2648 boolean sendToStepperModule =
false;
2649 SerialDebug.printf(
"***** processClientCommand_mainModule(%c) from client*****\n", cmd);
2661 sendToStepperModule =
true;
2666 SerialDebug.println(
"cmd=a startTimer");
2674 SerialDebug.println(
"cmd=A stopTimer");
2682 sendToStepperModule =
true;
2683 SerialLots.println(
"Setting FeedState = JACKPOT_FEED");
2689 SerialDebug.println(
"Setting feederType = UNO");
2702 SerialDebug.println(
"Setting feederType = MINI");
2713 SerialDebug.println(
"Setting feederType = Tumbler");
2728 SerialDebug.println(
"Toggle Buzzer via BLE: 'F'");
2735#ifdef LOCAL_NOT_REMOTE
2746 SerialDebug.println(
"Toggle remove Buzzer via BLE: 'f'");
2750 SerialDebug.printf(
"connectedBLEDeviceName = %s\n", connectedBLEDeviceName);
2752 if (connectedBLEDeviceName)
2754 SerialDebug.printf(
"Call Toggle Buzzer via BLE: 'F' - dev=%s\n", connectedBLEDeviceName);
2763 sendToStepperModule =
true;
2764 SerialDebug.println(
"Setting buzzStatus = BUZZON");
2777 sendToStepperModule =
true;
2779 SerialDebug.println(
"Setting buzzStatus = BUZZOFF");
2784 SerialDebug.println(
"*** Setting tilt = ON");
2789 SerialDebug.println(
"Setting tilt = OFF");
2794#ifdef NOT_SUPPORTED_RIGHT_NOW
2797 SerialDebug.println(
"OTA Update.. ");
2802#define SUPPORT_MINI_CLEAN
2803#ifdef SUPPORT_MINI_CLEAN
2808 SerialDebug.println(
"Clean EPROM.. so it's first time again");
2814 SerialDebug.println(
"Clean SSID from EPROM.. ");
2815 char cleanWIFI[100];
2816 strcpy(cleanWIFI,
"{'ssid':'','ssidPassword':''}");
2817 SerialDebug.println(cleanWIFI);
2829 SerialDebug.println(
"Clean Credentials");
2837 SerialDebug.println(
"Setting Gateway = ON");
2842 SerialDebug.println(
"Setting Gateway = OFF");
2848 SerialDebug.println(
"unused cmd '_'");
2850#ifdef OLD_FOR_M5_DISPLAY
2853 sendToStepperModule =
false;
2855 SerialDebug.println(
"Setting SM Zoom = zoomed");
2860 sendToStepperModule =
false;
2862 SerialDebug.println(
"Setting SM Zoom = full SM");
2872 SerialDebug.println(
"clean SPIFF file");
2879 SerialDebug.println(
"upload SPIFF to web");
2896 spiffFlag = !spiffFlag;
2898 SerialDebug.printf(
"Changing current USE_SPIFF = %s\n", spiffFlag?
"NOYES":
"NO");
2926 SerialDebug.println(
"w for swapWifi");
2934 SerialDebug.printf(
"PREFERENCE_STEPPER_AUTO_MOTOR_DIRECTION_SETTING true");
2944 SerialDebug.printf(
"PREFERENCE_STEPPER_AUTO_MOTOR_DIRECTION_SETTING false");
2951 SerialDebug.printf(
"PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING counter clockwise");
2959 SerialDebug.printf(
"PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING clockwise");
2967 SerialDebug.printf(
"PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING reverse direction");
2972 currentDirection = !currentDirection;
2978 SerialDebug.printf(
"PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING false");
2987 SerialDebug.printf(
"PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING true");
2997 SerialDebug.println(
"REBOOT ...");
3004 SerialDebug.printf(
"(%c) POWEROFF ...", cmd);
3012 SerialDebug.println(
"Clearing Sensors");
3046 SerialDebug.println(
"Setting modes for (a) PTStepper with (b) E mode 8.18.26");
3063 SerialDebug.println(
" *** performing m5atom OTA Update");
3066 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/TEST/M5Atom/ESP_IOT.ino.m5stick_c_plus.bin");
3071 SerialDebug.println(
" *** performing m5atom OTA Update - DAILY");
3074 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/TEST/M5Atom/daily/ESP_IOT.ino.m5stick_c_plus.bin");
3078 SerialDebug.println(
" *** performing m5atom OTA Update - BOOTSTRAP");
3081 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/Bootstrap/ESP_M5_BOOTSTRAP.ino.m5stack_stickc_plus.bin");
3083#pragma mark M5AtomS3 OTA
3090 SerialDebug.println(
" *** performing m5atomS3 OTA Update");
3093 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/TEST/M5AtomS3/ESP_IOT.ino.m5stick_c_plus.bin");
3097 SerialDebug.println(
" *** performing m5atomS3 OTA Update - DAILY");
3100 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/TEST/M5AtomS3/daily/ESP_IOT.ino.m5stick_c_plus.bin");
3105 SerialDebug.println(
" *** performing m5atomS3_platform.io OTA Update - DAILY");
3108 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/TEST/M5AtomS3/platform.io/daily/ESP_IOT.ino.m5stick_c_plus.bin");
3113 SerialDebug.println(
" *** performing m5atomS3_platform.io OTA Update - RELEASED");
3116 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/TEST/M5AtomS3/platform.io/ESP_IOT.ino.m5stick_c_plus.bin");
3135 SerialDebug.println(
" *** performing m5atom OTA Update - M5Clicker");
3138 performOTAUpdate((
char*)
"http://KnowledgeShark.org", (
char*)
"OTA/Bootstrap/ESP_M5_BOOTSTRAP.ino.m5stack_stickc_plus.bin");
3143 SerialDebug.println(
"'C' change color touched");
3146 fillpix(randomColor);
3156 char sendCapture[100];
3157 strcpy(sendCapture,
"{'send':'capture'}");
3158 SerialDebug.println(sendCapture);
3165#pragma mark BLE_SETTINGS
3169 SerialDebug.println(
" ! - BLE_Client on");
3177 SerialDebug.println(
" @ - BLE_Client off");
3185 SerialDebug.println(
" # - BLE_Server on");
3193 SerialDebug.println(
" $ - BLE_Server off");
3209 SerialTemp.println(VERSION);
3210 SerialMin.println(
"Valid Commands: ");
3211 SerialMin.println(
" . = help, this message");
3212 SerialMin.println(
" p = poweroff if can");
3213 SerialMin.println(
" 0x0, s, c == Single Feed - via BLE to connected device");
3214 SerialMin.println(
" a == AutoFeed On");
3215 SerialMin.println(
" A == AutoFeed Off");
3216 SerialMin.println(
" u == UNO ");
3217 SerialMin.println(
" m == MINI ");
3218 SerialMin.println(
" L == tumbler");
3219 SerialMin.println(
" H == autoMotorDirection on");
3220 SerialMin.println(
" h == autoMotorDirection off");
3221 SerialMin.println(
" D == FACTORY counter clockwise motor direction");
3222 SerialMin.println(
" d == FACTORY clockwise motor direction");
3223 SerialMin.println(
" Q == change motor direction opposite of current");
3226 SerialMin.println(
" F == Toggle Buzzer on/off");
3228 SerialMin.println(
" f == Toggle Buzzer on/off on BLE connected device");
3230 SerialMin.println(
" B == Buzzer On");
3231 SerialMin.println(
" b == Buzzer Off");
3232 SerialMin.println(
" G == Gateway On");
3233 SerialMin.println(
" g == Gateway Off");
3234 SerialMin.println(
" R == clean credentials");
3235 SerialMin.println(
" X == clean EPROM <<<< FIRST TIME DO THIS <<<< 7.26.26");
3236 SerialMin.println(
" x == clean SSID from EPROM");
3237 SerialMin.println(
" r == reboot ");
3240 SerialMin.println(
" T == tiltOn");
3241 SerialMin.println(
" t == tiltOff");
3242 SerialMin.println(
" N == send WIFI Credential to BLEServer");
3243 SerialMin.println(
" n == next WIFI Credential");
3244 SerialMin.println(
" W == retry WIFI");
3245 SerialMin.println(
" w == swap WIFI");
3246 SerialMin.println(
" C == change m5 atom to random color");
3247 SerialMin.println(
" i == take pic, {send:capture}");
3249 SerialMin.println(
" SPIFF internal memory ");
3250#ifndef OLD_FOR_M5_DISPLAY
3251 SerialMin.println(
" Z == clean SPIFF file");
3252 SerialMin.println(
" z == upload SPIFF to web");
3254 SerialMin.println(
" P == print SPIFF");
3255 SerialMin.printf (
" S == toggle SPIFF %s\n", spiffFlag?
"OFF":
"ON");
3257 SerialMin.println(
" BLE Naming ");
3259 SerialMin.println(
" E == use only PTFeeder naming");
3260 SerialMin.println(
" e == use naming PTFeeder:name");
3261#ifdef OLD_FOR_M5_DISPLAY
3262 SerialMin.println(
" Z == Setting SM Zoom = zoomed");
3263 SerialMin.println(
" z == Setting SM Zoom = full SM");
3265 SerialMin.println(
" Configurations of M5Atom ");
3267 SerialMin.println(
" k == no sensors");
3268 SerialMin.println(
" 1 == L9100S_DCStepper (current main)");
3270 SerialMin.println(
" 2 == ChainSensors (12.21.25))");
3271 SerialMin.println(
" 3 == *** PTStepperClass (original code - with M5");
3272 SerialMin.printf (
" 4 == M5AtomCamera\n");
3273 SerialMin.println(
" 8 == SMART Button, Clicker");
3274 SerialMin.println(
" 9 == M5TinyGPS, Clicker");
3275 SerialMin.println(
" 0 == M5AtomScanner, Clicker");
3276 SerialMin.println(
" = == E mode, then PTStepper (3)");
3279#ifdef NOT_SUPPORTED_RIGHT_NOW
3280 SerialMin.println(
" O == OTA update");
3282 SerialMin.println(
" OTA Updates of M5AtomLite -board M5StickCPlus ");
3283 SerialMin.println(
" 5 == m5atom DEV OTA update");
3284 SerialMin.println(
" 6 == m5atom DAILY TEST DEV OTA update");
3285 SerialMin.println(
" 7 == go back to m5atom BOOTSTRAP");
3288 SerialDebug.println(
" OTA updates for M5AtomS3 - board M5AtomS3");
3289 SerialDebug.println(
" y - _m5atomS3");
3290 SerialDebug.println(
" Y - _mm5atomS3Daily");
3291 SerialDebug.println();
3293 SerialDebug.println(
" OTA updates for M5AtomS3 - board M5AtomS3 - platform.io");
3294 SerialDebug.println(
" + _mm5atomS3 Daily_platform.io");
3295 SerialDebug.println(
" - _mm5atomS3 Released _platform.io");
3297 SerialDebug.println();
3300 SerialDebug.println(
" Turn On/Off BLE Server and Client");
3301 SerialDebug.println(
" ! - BLE_Client on");
3302 SerialDebug.println(
" @ - BLE_Client off");
3303 SerialDebug.println(
" # - BLE_Server on");
3304 SerialDebug.println(
" $ - BLE_Server off");
3305 SerialDebug.println(
" test -- create test user ");
3307 SerialDebug.println();
3309 SerialMin.println();
3310 SerialMin.println(
"Full API at: https://github.com/konacurrents/SemanticMarkerAPI");
3311 SerialMin.println();
3321 SerialMin.printf(
"*****invalid command '%c' from client (use '.' for help) *****\n", cmd);
3325#ifdef USE_STEPPER_MODULE
3326 if (sendToStepperModule)
3339 SerialDebug.printf(
"setConfiguration: %s\n", configurationName);
3341 if (strcmp(configurationName,
"PTStepper")==0)
3344 SerialDebug.println(
"Default PTStepperClass");
3348#ifdef DONT_ADD_TO_SENSORS
3351#ifdef ESP_M5_ATOM_S3
3401#pragma mark CHAIN BUTTON
3404 else if (strcmp(configurationName,
"ChainButtonClass")==0)
3407 SerialDebug.println(
"Default ChainButtonClass **** hardcoded button messages ****");
3409#ifdef ESP_M5_ATOM_S3
3437 savePreference_mainModule(
PREFERENCE_CHAIN_SENSORS_SETTING,
"ChainButtonClass,1,0,SM_MatrixCell,8,$all,ButtonClass,1,1,feed,,$pair,JoystickClass,2,0,feed,,$localhost");
3464 else if (strcmp(configurationName,
"ULN2003_StepperClass")==0)
3473 SerialDebug.println(
"Default ULN2003_StepperClass");
3497 else if (strcmp(configurationName,
"M5AtomCamera")==0)
3500 SerialDebug.println(
"Default M5AtomCamera");
3520 else if (strcmp(configurationName,
"M5TinyGPS")==0)
3523 SerialDebug.println(
"Default M5AtomTinyGPS");
3543 else if (strcmp(configurationName,
"M5AtomScanner")==0)
3546 SerialDebug.println(
"Default M5AtomScanner");
3566 else if (strcmp(configurationName,
"M5NoModule")==0)
3569 SerialDebug.println(
"Default M5AtomNoModule");
3591 SerialDebug.printf(
" **** Unknown Configuration: %s\n", configurationName);
3608 SerialLots.printf(
"Unix Time: %d\n", now);
3620 if (strncmp(cmd,
"sm",2) == 0)
3623 char *p = strchr(cmd,
'm');
3629 SerialLots.print(
"whichSMMode: ");
3630 SerialLots.print(cmd);
3631 SerialLots.print(
" => " );
3632 SerialLots.println(num);
3645 return (strcasecmp(cmd,mode)==0);
3651 SerialLots.printf(
"charSMMode_mainModule: %d\n", whichSMMode);
3691 SerialLots.print(
"setCurrentSMMode_mainModule:");
3692 SerialLots.println(whichSMMode);
3717 SerialTemp.print(
"incrementSMMode_mainModule:");
3757 SerialTemp.printf(
"auto-settingGateway(%d)\n", isGEN3);
3764 SerialCall.printf(
"setConnectedBLEDevice_mainModule: %s\n", deviceName);
3770 char *colon = index(deviceName,
':');
3772 colon = index(colon,
':');
3776 while (*colon && *colon !=
',')
3789 SerialTemp.print(
"connectedBLEName= ");
3794 seems to be crashing..
3796 char connectMessage[300];
3798 SerialTemp.println(connectMessage);
3814 colon += strlen(
"Address:");
3816 while (*colon && *colon ==
' ')
3821 while (*colon && *colon !=
',')
3834 SerialTemp.print(
"_connectedBLEDeviceAddress= ");
3848 nameToUse = (
char*)
"";
3888#ifdef USE_BUTTON_MODULE
3890 loop_ButtonProcessing();
3894#ifdef M5CORE2_MODULE
3896#elif defined(M5_ATOM)
3898#pragma mark USE_NEW_M5ATOMCLASS
3907 SerialDebug.println(
"*** _whichM5AtomClassType NULL ***");
3913#elif defined(M5BUTTON_MODULE)
3914 loop_M5ButtonModule();
3921 SerialDebug.println(
"setup_Sensors_mainModule");
3922#ifdef USE_BUTTON_MODULE
3924 setup_ButtonProcessing();
3928 SerialDebug.println(
" ***** M5_ATOM define ****");
3930#ifdef M5CORE2_MODULE
3936#pragma mark M5AtomClassType
3939#ifdef USE_NEW_M5ATOMCLASS
3952 int whichM5AtomIndex = 0;
3953 SerialDebug.println(
"setup_M5Atoms");
3970 SerialDebug.printf(
"**** sensors are more than max .. FIX CODE");
3972 SerialDebug.printf(
"Created %d M5AtomClassTypes\n", whichM5AtomIndex);
3979#pragma mark DEBUG_7_9_26
3981 if (!atomKind || strlen(atomKind) ==0)
3983 SerialDebug.println(
" **** no atomKind set .. use M5AtomNoModule");
3984 atomKind = (
char*)
"M5AtomNoModule";
3986 SerialDebug.printf(
"**** setting M5AtomNoModule %s\n", atomKind);
3994#pragma mark endDebug
4001 SerialDebug.println(
"NULL M5AtomClassType");
4014 SerialDebug.printf(
"** Found M5AtomClass = %s\n", atomKind);
4018 SerialDebug.printf(
"****^^^ Cannot find M5AtomClass = %s\n", atomKind);
4020 SerialDebug.println(
"Defaulting to _M5Atom_HDriverModuleClass");
4028#pragma mark USE_NEW_M5ATOMCLASS
4034#pragma mark DEBUG_7_9_26
4037#elif defined(M5BUTTON_MODULE)
4038 setup_M5ButtonModule();
4045#ifdef USE_BUTTON_MODULE
4048#ifdef M5CORE2_MODULE
4050#elif defined(M5_ATOM)
4051#pragma mark USE_NEW_M5ATOMCLASS
4055 SerialDebug.println(
"buttonA_ShortPress_mainModule");
4059#elif defined(M5BUTTON_MODULE)
4060 buttonA_ShortPress_M5ButtonModule();
4068#ifdef USE_BUTTON_MODULE
4071#ifdef M5CORE2_MODULE
4073#elif defined(M5_ATOM)
4075#pragma mark USE_NEW_M5ATOMCLASS
4079 SerialDebug.println(
"buttonA_LongPress_mainModule");
4083#elif defined(M5BUTTON_MODULE)
4084 buttonA_LongPress_M5ButtonModule();
4092#ifdef USE_BUTTON_MODULE
4098#ifdef M5CORE2_MODULE
4100#elif defined(M5_ATOM)
4102#pragma mark USE_NEW_M5ATOMCLASS
4106 SerialDebug.println(
"buttonA_LongLongPress_mainModule");
4111 SerialDebug.println(
" *** buttonA_LongLongPress undefined ****");
4114#elif defined(M5BUTTON_MODULE)
4115 buttonA_LongLongPress_M5ButtonModule();
4123#ifdef USE_BUTTON_MODULE
4126#ifdef M5BUTTON_MODULE
4128 buttonB_LongPress_M5ButtonModule();
4134#ifdef USE_BUTTON_MODULE
4138#ifdef M5BUTTON_MODULE
4140 buttonB_ShortPress_M5ButtonModule();
4143#pragma mark BUTTON Processing of M5
4154 if (M5.BtnA.wasPressed())
4157 SerialDebug.println(
"MainModule M5.BtnA **** wasPressed ***");
4160 else if (M5.BtnA.wasReleasefor(4500))
4163 SerialDebug.println(
"MainModule M5.BtnA **** LONG LONG PRESS ***");
4166 else if (M5.BtnA.wasReleasefor(1000))
4169 SerialDebug.println(
"MainModule M5.BtnA **** LONG PRESS ***");
4172 else if (M5.BtnA.wasReleased())
4175 SerialDebug.println(
"MainModule M5.BtnA **** wasReleased ***");
4178#elif defined(ESP_M5_ATOM_S3)
4181 if (AtomS3.BtnA.wasPressed())
4184 SerialDebug.println(
"MainModule M5.BtnA **** wasPressed ***");
4187 else if (AtomS3.BtnA.wasReleasefor(4500))
4190 SerialDebug.println(
"MainModule M5.BtnA **** LONG LONG PRESS ***");
4193 else if (AtomS3.BtnA.wasReleasefor(1000))
4196 SerialDebug.println(
"MainModule M5.BtnA **** LONG PRESS ***");
4199 else if (AtomS3.BtnA.wasReleased())
4202 SerialDebug.println(
"MainModule M5.BtnA **** wasReleased ***");
4208 if (M5.BtnA.wasPressed())
4211 SerialDebug.println(
"MainModule M5.BtnA **** wasPressed ***");
4214 else if (M5.BtnA.wasReleasefor(4500))
4217 SerialDebug.println(
"MainModule M5.BtnA **** LONG LONG PRESS ***");
4220 else if (M5.BtnA.wasReleasefor(1000))
4223 SerialDebug.println(
"MainModule M5.BtnA **** LONG PRESS ***");
4226 else if (M5.BtnA.wasReleased())
4229 SerialDebug.println(
"MainModule M5.BtnA **** wasReleased ***");
4251 if (M5.BtnB.wasReleasefor(4500))
4254 SerialDebug.println(
"MainModule M5.BtnB **** LONG LONG PRESS ***");
4257 else if (M5.BtnB.wasReleasefor(1000))
4260 SerialDebug.println(
"MainModule M5.BtnB **** LONG PRESS ***");
4263 else if (M5.BtnB.wasReleased())
4266 SerialDebug.println(
"MainModule M5.BtnB **** SHORT PRESS ***");
4272 else if (M5.BtnB.wasDoubleClicked())
4275 SerialDebug.println(
"MainModule M5.BtnB **** DOUBLE PRESS ***");
4308#pragma mark PIN_USE_STRUCT
4309#pragma mark PIN USE to see if overlaps.
4316 char *pinUseArray[PIN_USE_MAX];
4318 long pinNumArray[PIN_USE_MAX];
4342 char pinUseSample[100];
4343 sprintf(pinUseSample,
"PIN_USE: %2d = %s, %s %s", pin, pinName.c_str(), moduleName.c_str(), isI2C?
"(I2C)":
"");
4346 boolean validPins =
true;
4347#ifdef ESP_M5_ATOM_S3
4405 SerialError.printf(
"**** Invalid pin: %d, %s\n", pin, pinUseSample);
4409 char *pinUse = (
char*)calloc(strlen(pinUseSample)+1,
sizeof(char));
4410 strcpy(pinUse, pinUseSample);
4421 SerialError.printf(
"*** ERROR .. too many PINS defined ***");
4426 SerialDebug.printf(
"** PIN_USE: %s = %d, module=%s %s\n", pinName.c_str(), pin, moduleName.c_str(), isI2C?
"(I2C)":
"");
4431#pragma mark LED Buttons
4443 int color = TFT_BLUE;
4471 String colorString =
"TFT_RED";
4473 case TFT_WHITE: colorString =
"TFT_WHITE";
break;
4474 case TFT_CYAN: colorString =
"TFT_CYAN";
break;
4475 case TFT_RED: colorString =
"TFT_RED";
break;
4476 case TFT_YELLOW: colorString =
"TFT_YELLOW";
break;
4477 case TFT_BLUE: colorString =
"TFT_BLUE";
break;
4480 case TFT_GREEN: colorString =
"TFT_GREEN";
break;
4489 M5.Led.setAllColor(color);
4524 String colorString =
"RED_LED";
4526 case RED_LED: colorString =
"RED_LED";
break;
4527 case BLUE_LED: colorString =
"BLUE_LED";
break;
4528 case GREEN_LED: colorString =
"GREEN_LED";
break;
4529 case YELLOW_LED: colorString =
"YELLOW_LED";
break;
4530 case CYAN_LED: colorString =
"CYAN_LED";
break;
4533 case WHITE_LED: colorString =
"WHITE_LED";
break;
4547 SerialDebug.printf(
"setLEDColor(%s) NOT IMPLEMENTED\n",
getColorString(color));
void sendCommandBLEClient(String cmdString)
boolean isConnectedBLEClient()
returns whether connected over BLE as a client to a server(like a ESP feeder)
void sendFeedCommandBLEClient()
sends the "feed" command over bluetooth to the connected device..
boolean useBLEClient()
returns if the BLEClient is turned on.. note, if connected to a BLE device, then disconnect
void sendCommandBLEClient_13orLess(String cmdString)
send a string of 13 characters or less
void sendBLEMessageACKMessage()
send ACK over bluetooth, this right now is 0x01
char * getServiceName_BLEServerNetworking()
retrieve the service name (PTFEEDER, PTFeeder:Name, PTClicker:Name, etc)
#define BLE_SERVER_CALLBACK_ONWRITE
void addToTextMessages_displayModule(String text)
void redrawSemanticMarker_displayModule(boolean startNew)
redraws the image..
void blankScreen_displayModule()
blanks the screen
int getLoopTimer_displayModule()
returns the loop timer (just a timer..)
void setup_M5Core2Module()
void buttonA_LongLongPress_M5Core2Module()
long press on buttonA (top button)
void loop_M5Core2Module()
called for the loop() of this plugin
char * currentStatusJSON_M5Core2Module()
void messageSend_M5Core2Module(char *sendValue)
void messageSetVal_M5Core2Module(char *setName, char *valValue, boolean deviceNameSpecified)
void buttonA_ShortPress_M5Core2Module()
void publishMQTTMessageDefaultTopic(char *message)
Wrapper of the mqttclient publish.
void cleanEPROM_MQTTNetworking()
cleans the eprom info
void sendMessageNoChangeMQTT_Topic(char *message, char *topic)
just send a message but without any extras
void sendMessageMQTT(char *message)
void sendStatusMessageMQTT(const char *semanticMarker)
sends the semantic marker as a doc follow message #remoteMe (vs STATUS, as that triggers a status rep...
boolean processJSONMessageMQTT(char *ascii, char *topic)
process the JSON message (looking for FEED, etc). Note: topic can be nil, or if not,...
void sendMessageMQTT_Topic(char *message, char *topic)
for now only send if it start message starts with "#"
void sendDocFollowMessageMQTT(const char *semanticMarker)
sends the semantic marker as a doc follow message
void sendMessageNoChangeMQTT(char *message)
just send a message but without any extras
boolean isConnectedMQTT_MQTTState()
value of MQTT connected
char * getDeviceNameMQTT()
called for things like the advertisement
boolean isConnectedWIFI_MQTTState()
value of WIFI connected
void restartWIFI_MQTTState()
restart the WIFI and then MQTT connection
#define MQTT_CALLBACK_FEED
8.16.25 MQTT
void cleanEpromPreferences()
cleans the EPROM
void sendSemanticMarkerDocFollow_mainModule(const char *SMDocFollowAddress)
sends the SM on the DOCFOLLOW channel (publish it..)
M5Atom_NoModuleClass * _M5Atom_NoModuleClass
void initCallbacksMain()
init the callbacks to dummy callbacks
boolean _longPressB_MainModule
#define MESSAGE_STORAGE_MAX
global for others to use..
boolean _connecteBLEisGEN3
whether connected GEN3
void setAsyncCallOTAUpdate(bool flag)
sets the async OTA flag (for next loop)
void main_cleanSavedWIFICredentials()
clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22)
void messageSend_mainModule(char *sendValue, boolean deviceNameSpecified)
TODO: have a callback regist approach.
boolean _asyncCallOTAUpdateFlag
3.28.22 .. implemented in ESP_IOT.ino
boolean _stopAllProcessing
testing..
M5Atom_Core2ModuleClass * _M5Atom_Core2ModuleClass
char * createCopy2(const char *stringA)
#define CALLBACKS_MQTT
8.16.25 MQTT
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...
ChainButtonClass * _ChainButtonClass
void setConnectedBLEDevice_mainModule(char *deviceName, boolean isGEN3)
char _fullBLEDeviceName[100]
full: ""Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead"
boolean registerPinUse_mainModule(long pin, String pinName, String moduleName, boolean isI2C)
SensorClassType * _SensorClassTypes[NUM_SENSOR_CLASS_TYPES]
#define CALLBACKS_MAX_BLE_SERVER
KeyUnitSensorClass * _KeyUnitSensorClass
char * connectedBLEDeviceNameAddress_mainModule()
returns address part of name.
void cleanSSID_EPROM_MessageCallback(char *message)
clean the SSID eprom (MQTT_CLEAN_SSID_EPROM)
callbackSignature * createMemory(int max)
return dyamically created array of max
void toggleMinimalMenuMode_mainModule()
toggles the menu mode
char * charSMMode_mainModule(int whichSMMode)
returns string form whichSMMode, sg "sm0", sm1 ...
char * main_getUsername()
#define NUM_SENSOR_CLASS_TYPES
5.14.25
char * groupTopicFullName(char *groupName)
returns a groupTopic to use as a topic
char _smMode_MainModule[10]
current smMode
void loop_mainModule()
called for the loop() of this plugin
char * getSemanticMarkerDocFollow_mainModule()
gets the semanticAddress SemanticMarkerâ„¢
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....
M5Atom_HDriverModuleClass * _M5Atom_HDriverModuleClass
char * deviceName_mainModule()
gets the device name
int getLUXThreshold_mainModule(int thresholdKind)
get the threshold val
void dummyCallbackMain(char *message)
example callback
boolean _longLongPressB_MainModule
#define CALLBACKS_MAX_MQTT
void initGlobals_mainModule()
init globals strings
void sendStatusMQTT_mainModule()
1.1.24 send status of this device after events..
PinUseStruct _pinUseStruct
7.31.25 add this for a status, saw that QRCode was using 22 also .. so buzer didn't work.
char _deviceNameSave[50]
saved deviceName storage..
void initSensorClassTypeArray()
boolean connectedBLEDeviceIsGEN3_mainModule()
whether the connected is a GEN3 (so the name isn't valid)
boolean _shortPress_MainModule
5.6.25 use the M5Atom ClassType
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 setLEDColorUnified(int color)
#define CALLBACKS_BLE_SERVER
boolean _asyncCallFlags[ASYNC_CALL_MAX]
storage for asyncCallCommands
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)
boolean _longLongPress_MainModule
char _scannedDeviceName[100]
int getFeedCount_mainModule()
feedcount info..
void onStatusMessageBLEServerCallback(char *message)
The callback for "status messages" of the bluetooth.
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
int feedCountMax_mainModule()
returns the max for this feeder
char _scannedGroupTopicName[100]
M5Atom_CameraModuleClass * _M5Atom_CameraModuleClass
void setClockwiseMotorDirection_mainModule(boolean isClockwiseFlag)
8.18.24 setting this will check for the factory setting..
void solidLightOnOff(boolean onOff)
callback for SOLID blinking led
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 checkButtonB_MainModule()
buttonB will set the _shortPressB .. fields
uint32_t _chipID_MainModule
3.17.24 the unqiue chip id
void main_credentialsUpdated()
moved here 4.25.22 (entirely from ESP_IOT.ino)
void setup_mainModule()
called from the setup()
void loopSensorClassTypeArray()
11.27.25 Turkey Day, loop
void main_dispatchSyncCommand(int syncCallCommand)
the main sync command (no parameters yet)
boolean stopAllProcesses_mainModule()
if stopped
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
PIRSensorClass * _PIRSensorClass
boolean isTrueString_mainModule(String valCmdString)
whether the string is TRUE, ON, 1
char * main_getPassword()
return password
boolean _shortPressB_MainModule
int whichSMMode_mainModule(char *cmd)
************** SM Mode Processing ***************
M5Atom_SocketModuleClass * _M5Atom_SocketModuleClass
instances of the M5AtomClassType
void main_dispatchAsyncCommandWithString(int asyncCallCommand, char *parameter)
void initAsyncCallFlags()
initialize the async call flags (with and without parameters)
boolean _doublePressB_MainModule
String getColorStringUnified(int color)
returns a string for the color int
void solidLightMessageCallback(char *message)
callback for SOLID blinking led
M5AtomClassType * _M5AtomClassTypes[NUM_M5ATOM_CLASS]
3.31.25 create array of plugs
M5AtomClassType * _whichM5AtomClassType
use this one...
boolean isEmptyString(char *stringA)
informs if null or empty string
void rebootDevice_mainModule()
void setConfiguration_mainModule(char *configurationName)
void poweroff_mainModule()
power off
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
#define GROUP_TOPIC_TO_SEND
boolean isPTFeeder_mainModule()
gets if PTFeeder a surrogate for the M5Atom class
bool containsSubstring(String message, String substring)
check if the string contains the other string. This is a poor man's grammer checker
void decrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
M5Atom_QRCodeModuleClass * _M5Atom_QRCodeModuleClass
void onWriteBLEServerCallbackFinish(char *message)
The FINISH of callback for "onWrite" of the bluetooth "onWrite'.
void callCallbackMain(int callbacksModuleId, int callbackType, char *message)
performs the indirect callback based on the callbackType
int getCurrentSMMode_mainModule()
returns the current SM Mode
boolean _longPress_MainModule
boolean _waitingForBigMessageEnd
store a big message #MSG_START .. #MSG_END
void buttonA_LongLongPress_mainModule()
long long press on buttonA (top button)
void stopMotor_mainModule()
added 9.29.22 to support wildcards #196
void stopProcessesForOTAUpdate_mainModule()
stop all loops... while OTA working..
void feedMessageCallback(char *message)
void resetFeedCount_mainModule()
sets the feed count max
boolean asyncCallOTAUpdate()
performs an async OTA update
void sendMessageString_mainModule(char *messageString)
adding a synchronous call to send a message over the network (assuming MQTT but not specified),...
char * main_currentStatusJSON()
status in JSON format, needs to return something as a ',' is already added before calling this....
M5AtomClassType * whichM5AtomClassType()
6.6.25 get the current M5AtomClassType
void(* callbackSignature)(char *)
void changeButtonColor_MainModule()
2.21.25 add a way to change the button color (if any)
void setup_Sensors_mainModule()
1.22.24 setup of buttons
char * getFullBLEDeviceName_mainModule()
full: ""Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead"
void checkButtonA_MainModule()
big button on front of M5StickC Plus
char _groupTopicName[100]
int getFeederType_mainModule()
get the feeder type (Sepper 1,2,3 ...)
char _connectedBLEDeviceName[50]
saved BLE connected name 8.26.22
char * _lastSemanticMarkerDocFollow
char _connectedBLEDeviceAddress[50]
full: ""Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead"
void addMoreStatusQueryString()
void buttonA_LongPress_mainModule()
long press on buttonA (top button)
void addStatusBooleanFlag(const char *key, boolean flag)
adds to _fullStatusString a query string "&key=value"
void invokeAsyncCommands()
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
#define CALLBACKS_MAX_BLE_CLIENT
String getColorString(ColorsUnified color)
returns a string for the color int
int getRandomColorUnified()
7.24.25 return a (semi) random color
boolean startsWithChar(char *str, char c)
a char* version of startsWith (after skipping spaces)
void showText_mainModule(String text)
callbackSignature * _allCallbacks[CALLBACKS_MODULE_MAX]
array of known size (CALLBACKS_MODULE_MAX) of callbackSignatures
void setCurrentSMMode_mainModule(int whichSMMode)
sets the current screen mode .. which can be used by Button and Display processing
char * getPairedDeviceOrAddress_mainModule()
returns if the paired device is not NONE .. returns address or device
long _randomColorIndex
these are the constanst for the colors
char _chipIdString_MainModule[15]
string like: 10311304
char * getPairedDevice_mainModule()
returns if the paired device is not NONE
void onWriteBLEServerCallback(char *message)
The callback for "onWrite" of the bluetooth "onWrite'.
char * _MQTT_Password
12.14.23
char * getServerServiceName_mainModule()
void setLUXThreshold_mainModule(int thresholdKind, int luxVal)
set the threshold val
boolean _callbacksInitializedMain
flag for initializing if not yes
#define CALLBACKS_BLE_CLIENT
void main_dispatchAsyncCommand(int asyncCallCommand)
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
char _JSONStringForWIFICredentials[200]
global to store credentials when ever they are stored..
boolean matchesSMMode_mainModule(char *cmd, int whichSMMode)
returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn
int _feedCount_mainModule
5.3.22 added a feed count approach.. (NOTE: there is a _feedCount in Dispence.cpp ....
BuzzerSensorClass * _BuzzerSensorClass
int _saveWhichSMMode
the saved SMMode
PinUseStruct * getPinUseStruct_mainModule()
get the pin use array
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.
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)
char _asyncParameter[500]
the parameter being sent to those commands passing an argument
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..
char * main_getScannedDeviceName()
return devicename
char * createCopy(char *stringA)
#define CALLBACKS_MAX_BUTTON_MODULE
boolean _asyncCallFlagsParameters[ASYNC_CALL_PARAMETERS_MAX]
array of async flags for the different ASYNC_CALl values
char _fullStatusString[500]
status string (URL query format)
void main_printModuleConfiguration()
M5Atom_TinyGPSModuleClass * _M5Atom_TinyGPSModuleClass
void messageSetVal_mainModule(char *setName, char *valValue, boolean deviceNameSpecified)
void singleClickTouched(char *whichButton)
float getTemperature_mainModule()
retrieves the temperature .
void buttonA_ShortPress_mainModule()
boolean isValidPairedDevice_mainModule()
returns if the paired device is not NONE. Note, the paired Name might be an address now (see below)
boolean _doublePress_MainModule
char * main_nextJSONWIFICredential()
! cycle through the next WIFI saved credential
void onBLEServerCallback(char *message)
The callback for "onWrite" of the bluetooth "onWrite'.
void addStatusStringFlag(const char *key, char *val)
adds a query string "&key=value"
void incrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
#define CALLBACKS_BUTTON_MODULE
char _messageStorage[MESSAGE_STORAGE_MAX]
void incrementFeedCount_mainModule()
increments .. and if MAX goes to 0 – and sends a message on MQTT
void messageSetVal_SensorClassTypeArray(char *setName, char *valValue, boolean deviceNameSpecified)
void espUpdate_mainModule(int num)
the Update aggrgate
void main_saveWIFICredentials(char *ssid, char *ssid_password)
save the WIFI credential
ColorsUnified getRandomColor()
7.24.25 return a (semi) random color
void espBegin_mainModule(int num)
void readPreferences_mainModule()
reads the preferences. Save is everytime the savePreference is called
char * getPairedDeviceAddress_mainModule()
returns if the paired device is not NONE
float getBatPercentage_mainModule()
start of the sensor updates ... TODO: tie these to the MQTT messaging as well..
void setLEDColor(ColorsUnified color)
uses colors.. _GREEN to be typed values
int _callbacksFunctionsMAXS[CALLBACKS_MODULE_MAX]
the array of callback functions
#define ASYNC_CALL_FEED_COMMAND
sends a 'c' to the BLE end of the code (assuming a feeder is connected). Need to morph if a real feed...
#define MAX_SM_MIN_MODES
note for now, heep the max the same – so only goes through zoom or not zoom
void cleanEPROM_mainModule()
cleans the main module EPROM
#define ASYNC_CALL_MAX
the max one greater than last one
#define THRESHOLD_KIND_DARK
#define ASYNC_REBOOT
sets the GATEWAY mode off
#define ASYNC_CALL_BLE_CLIENT_PARAMETER
these are the async with a string parameter. This sends a BLE command unless MQTT
#define ASYNC_REST_CALL_MESSAGE_PARAMETER
send REST call
#define ASYNC_SEND_MQTT_FEED_MESSAGE
sends a message (like FEED) on the users topic
#define CALLBACKS_MODULE_MAX
#define ASYNC_JSON_MQTT_MESSAGE_PARAMETER
these are the async with a string parameter
#define ASYNC_CALL_CLEAN_CREDENTIALS
cleans out the credentials and restarts in AP (Access Point) mode.
#define ASYNC_SWAP_WIFI
swaps WIFI 'w'
#define ASYNC_SET_GATEWAY_ON
sets the GATEWAY mode on
#define MAX_SM_EXPANDED_MODES
#define ASYNC_RESTART_WIFI_MQTT
restarts the WIFI (after BLE interrupt over)
#define THRESHOLD_KIND_LIGHT
#define ASYNC_CALL_BUZZ_ON
sends a 'B' to the BLE end of the code (assuming a feeder is connected).
#define ASYNC_POWEROFF
sets the GATEWAY mode off
#define ASYNC_CALL_CLEAN_EPROM
cleans the EPROM totally, and reboots
#define ASYNC_BLANKSCREEN
blank the screen
#define ASYNC_CALL_PARAMETERS_MAX
the max one greater than last one
#define ASYNC_SEND_MQTT_STATUS_URL_MESSAGE
sends the status from the main module URL
#define ASYNC_SET_GATEWAY_OFF
sets the GATEWAY mode off
#define ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER
these are the async with a string parameter
#define ASYNC_CALL_OTA_UPDATE
TODO: make this a registeration approach.
#define ASYNC_NEXT_WIFI
next WIFI 'n'
#define ASYNC_CALL_BUZZ_OFF
sends a 'b' to the BLE end of the code (assuming a feeder is connected).
#define ASYNC_CLICK_SOUND
5.15.25 add a BUZZ command (or CLICK)
#define ASYNC_JSON_MESSAGE_PARAMETER
these are the async with a string parameter
void updateMenuState(ModelKindEnum modelKind)
updates the model for the menu state, this sets max etc
void startStopTimer_mainModule(boolean startTimer)
void initModelStructs_ModelController()
initialize the objects
void restartAllMenuStates_ModelController()
restarts all the menu states to the first one .. useful for getting a clean start....
void performOTAUpdateSimple()
retrieves from constant location
void performOTAUpdate(char *hostname, char *httpAddress)
8.16.25 MQTT
void savePreferenceInt_mainModule(int preferenceID, int val)
sets an int preference
void savePreferenceBoolean_mainModule(int preferenceID, boolean flag)
save a boolean preference
void printSensors_mainModule(SensorsStruct *sensors)
print sensors, passing in a struct
SensorsStruct * getSensors_mainModule()
return the sensors defined
void initChainSensorStringsFromEPROM_mainModule()
void setSensorsString_mainModule(char *sensorsString)
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 registerChain_mainModule(String classType, int buttonNumber, int pressKind, String setString, String valString, String deviceString)
void togglePreferenceBoolean_mainModule(int preferenceID)
toggles a preference boolean
char * getPreferenceATOMKind_MainModule()
new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner)
void savePreferenceFloat_mainModule(int preferenceID, float val)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
int getM5ATOMKind_MainModule()
new 1.4.24 setting ATOM kind (eg. ATOM_KIND_M5_SCANNER, ATOM_KIND_M5_SOCKET)
int getPreferenceInt_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
char * getPreference_mainModule(int preferenceID)
SensorStruct * getSensor_mainModule(char *sensorName)
return the sensor specified or null
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 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...
#define PREFERENCE_USE_SPIFF_SETTING
8.22.22 to turn on/off SPIFF use (more below..)
#define PREFERENCE_PAIRED_DEVICE_ADDRESS_SETTING
the paired device for guest device feeding (6.6.22) .. but the Address 9.3.22
#define PREFERENCE_STEPPER_KIND_VALUE
uses STEPPER type
#define PREFERENCE_SENSOR_TILT_VALUE
Sensor preferences.
#define PREFERENCE_SENSOR_PLUGS_SETTING
#define PREFERENCE_STEPPER_FACTORY_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING
if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
#define PREFERENCE_ONLY_GEN3_CONNECT_SETTING
if true, only BLEClient connect to GEN3 feeders..
#define PREFERENCE_SENDWIFI_WITH_BLE
sends the WIFI to all except current device if set
#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE
Display preferences (SemanticMarker etc) - boolean.
#define PREFERENCE_STEPPER_JACKPOT_FEED_VALUE
#define PREFERENCE_WIFI_CREDENTIAL_2_SETTING
#define PREFERENCE_STEPPER_RPM_SETTING
#define PREFERENCE_MAIN_BLE_SERVER_VALUE
#define PREFERENCE_PAIRED_DEVICE_SETTING
the paired device for guest device feeding (6.6.22)
#define PREFERENCE_STEPPER_BUZZER_VALUE
stepper preferences
#define STEPPER_IS_TUMBLER
#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING
#define PREFERENCE_WIFI_CREDENTIAL_1_SETTING
#define PREFERENCE_USE_SPIFF_MQTT_SETTING
#define PREFERENCE_CHAIN_SENSORS_SETTING
#define WIFI_CREDENTIALS_MAX
for now, save 2 WIFI Credentials
#define BUTTON_SHORT_PRESS
#define PREFERENCE_FIRST_TIME_FEATURE_SETTING
a firsttime feature flag (only 1 per build) 7.12.22 defaulting to TRUE
#define PREFERENCE_IS_MINIMAL_MENU_SETTING
sets the max temp for a poweroff
#define PREFERENCE_USE_SPIFF_QRATOM_SETTING
For MQTT writing to the QRATOM.
#define PREFERENCE_DEVICE_NAME_SETTING
the device name itself (6.6.22)
#define PREFERENCE_HIGH_TEMP_POWEROFF_VALUE
sets the max temp for a poweroff
#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING
#define BUTTON_LONG_PRESS
#define PREFERENCE_STEPPER_2FEED_SETTING
#define PREFERENCE_STEPPER_AUTO_MOTOR_DIRECTION_SETTING
#define PREFERENCE_MAIN_GATEWAY_VALUE
#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING
#define PREFERENCE_MAIN_BLE_CLIENT_VALUE
#define PREFERENCE_ATOM_KIND_SETTING
1.4.24 What kind of ATOM plug (set, M5AtomKind, val= {M5AtomSocket, M5AtomScanner}
void sendStrings_SPIFFModule(int numberOfLines)
sends SPIFF module strings over MQTT, starting at the number back specified. This will use the curren...
void printFile_SPIFFModule()
prints the spiff file to the SerialDebug output
void deleteFiles_SPIFFModule()
delete the spiff files..
void stepperModule_ProcessClientCmdFinal(char cmd)
the Blink the LED - and it will use the latest BUZZER status (so MQTT could set buzzer on....
void setup_tokenParser_mainModule()
setup a test ..
char * semanticMarkerToJSON_TokenParser(char *semanticMarker)
void blinkLED_UIModule()
blink the LED
void solidLightOnOff_UIModule(boolean onOff)
turns on/off a solid light
void clean_SSID_WIFICredentials()
returns true if the SSID is set, false otherwise. If set, then just exit..
void WIFI_APModule_updateMQTTInfo(char *ssid, char *ssid_password, char *username, char *password, char *guestPassword, char *deviceName, char *host, char *port, char *locationString)
sets the MQTT user/password. It's up to the code to decide who needs to know
boolean doneWIFI_APModule_Credentials()
called to see if the WIFIModule has finished bootstrapping..
void cleanEPROM_WIFI_APModule()
cleans the eprom info
void setDoneWIFI_APModuleFlag(boolean flag)
called to set the done flag
virtual void messageSend_M5AtomClassType(char *sendValue, boolean deviceNameSpecified)=0
virtual void loop_M5AtomClassType()=0
loop the PTStepper (so timer can run)
virtual boolean isPTFeeder_M5AtomClassType()
virtual void buttonA_ShortPress_M5AtomClassType()=0
virtual char * currentStatusJSON_M5AtomClassType()=0
virtual void buttonA_LongPress_M5AtomClassType()=0
long press on buttonA (top button)
virtual void messageSetVal_M5AtomClassType(char *setName, char *valValue, boolean deviceNameSpecified)=0
these are from the ATOM
virtual void setup_M5AtomClassType()=0
setup the PTStepper
virtual void stop_M5AtomClassType()=0
stop the motor
virtual char * currentStatusURL_M5AtomClassType()=0
virtual void buttonA_LongLongPress_M5AtomClassType()
11.25.25 Add LONG LONG press for the AP mode
virtual void loop()=0
Pure Virtual Function.
void setPinValues(int pin1, int pin2)
virtual void messageSetVal_SensorClassType(char *setName, char *valValue, boolean deviceNameSpecified)
virtual void setup()=0
Pure Virtual Function.
virtual void messageLocal_SensorClassType(char *message)
5.15.25 try a special command local to this class
long pinNumArray[PIN_USE_MAX]
each pin
char * pinUseArray[PIN_USE_MAX]
string describing the module, etc
SensorClassType * sensorClassType
and the pointer to matching SensorClassType
SensorStruct * sensors
array of sensorStruct