10#ifdef USE_BUTTON_MODULE
12#define USE_TIMER_DELAY_CLASS
14#ifdef USE_TIMER_DELAY_CLASS
16void startDelay_ButtonProcessing(
int seconds)
18 _timerDelayClass_ButtonModule->
startDelay((
float)seconds);
20boolean delayFinished_ButtonProcessing()
24void stopDelay_ButtonProcessing()
26 _timerDelayClass_ButtonModule->
stopDelay();
35unsigned long _delayStart_ButtonProcessing;
37boolean _delayRunning_ButtonProcessing =
false;
39int _delaySeconds_ButtonProcessing;
41void startDelay_ButtonProcessing(
int seconds)
43 SerialCall.printf(
"startDelay_ButtonProcessing: %d\n", seconds);
45 _delayStart_ButtonProcessing =
millis();
46 _delayRunning_ButtonProcessing =
true;
47 _delaySeconds_ButtonProcessing = seconds;
51boolean delayFinished_ButtonProcessing()
53 if (_delayRunning_ButtonProcessing && ((
millis() - _delayStart_ButtonProcessing) >= (_delaySeconds_ButtonProcessing * 1000)))
55 _delayRunning_ButtonProcessing =
false;
56 SerialCall.println(
"delayFinished_ButtonProcessing..");
63void stopDelay_ButtonProcessing()
65 SerialCall.println(
"stopDelay_ButtonProcessing _delayRunning=false");
67 _delayRunning_ButtonProcessing =
false;
73int getDelayNoClickPoweroffSetting()
79void refreshDelayButtonTouched()
81 startDelay_ButtonProcessing(getDelayNoClickPoweroffSetting());
85void refreshDelayButtonTouched_ButtonProcessing()
87 SerialLots.println(
"refreshDelayButtonTouched_ButtonProcessing");
89 refreshDelayButtonTouched();
94void checkDelaySinceButtonTouched()
96 if (delayFinished_ButtonProcessing())
100 SerialMin.printf(
"GATEWAY so no poweroff, but %d seconds with no buttons/feed\n", getDelayNoClickPoweroffSetting());
104 SerialMin.printf(
"User set no poweroff, but %d seconds with no buttons/feed\n", getDelayNoClickPoweroffSetting());
112 SerialMin.printf(
"buttonProcessor invoking poweroff after %d seconds with no buttons\n", getDelayNoClickPoweroffSetting());
141void toggleSM_Zoomed()
149void invokeCurrentSemanticMarker()
163void performProcessCurrentMode()
174 SerialCall.print(
"performProcessCurrentMode: blank:");
175 SerialCall.println(justWakeup);
180 SerialTemp.print(
"currentSMMode: ");
192 SerialTemp.printf(
"modelChanged(%d)\n", modelChanged);
201 SerialTemp.printf(
"SMmode=%d, now=%d\n", currentSMMode,currentSMModeNow);
202 if (currentSMMode != currentSMModeNow)
203 invokeCurrentSemanticMarker();
214 SerialCall.println(
"SM_home_simple");
220 invokeCurrentSemanticMarker();
224 SerialCall.println(
"SM_home_simple_1");
234 invokeCurrentSemanticMarker();
240 SerialCall.println(
"SM_home_simple_2");
246 invokeCurrentSemanticMarker();
252 SerialCall.println(
"SM_home_simple_3");
258 invokeCurrentSemanticMarker();
303 invokeCurrentSemanticMarker();
313 sprintf(_smMessage,
"FEED {'deviceName':'%s'}",pairDevice);
333#ifdef CHANGED_TO_JUST_MIN_MAX
341 SerialCall.print(
"Setting MINIMAL_MENU: ");
342 SerialCall.println(isZoomed?
"ZOOMED":
"UNZOOMED");
351 invokeCurrentSemanticMarker();
371 SerialTemp.print(
"SM_doc_follow: ");
372 SerialTemp.println(statusURL);
379 SerialMin.println(
"rebooting..");
392 SerialCall.print(
"currentSMMode: ");
404void buttonA_LongPress()
406 SerialTemp.println(
"long press.. processMode");
409 performProcessCurrentMode();
415void buttonA_ShortPress()
418 SerialTemp.println(
"buttonA_ShortPress");
462void buttonB_LongPress()
465 SerialCall.println(
"B.long press.. toggleZoom or incrementColor");
496void buttonB_ShortPress()
500 SerialCall.println(
"buttonB shortPress");
519 SerialCall.print(
"current mode:");
526 invokeCurrentSemanticMarker();
534void setup_ButtonProcessing()
540boolean _firstLoopProcessing =
true;
542void loop_ButtonProcessing()
546 if (_firstLoopProcessing)
548 invokeCurrentSemanticMarker();
549 _firstLoopProcessing =
false;
560void buttonA_ShortPress() {}
562void buttonA_LongPress() {}
564void buttonB_LongPress() {}
566void buttonB_ShortPress() {}
void sendCommandBLEClient_13orLess(String cmdString)
send a string of 13 characters or less
void incrementScreenColor_displayModule()
boolean isBlankScreen_displayModule()
whether screen is blank (so the button can be a wake, vs action..)
void showText_displayModule(String text)
void redrawSemanticMarker_displayModule(boolean startNew)
redraws the Semantic Marker image..
const char * currentSemanticMarkerAddress_displayModule()
returns the current semantic marker (eg. guest page)
void sendMessageMQTT(char *message)
boolean processJSONMessageMQTT(char *ascii, char *topic)
process the JSON message (looking for FEED, etc). Note: topic can be nil, or if not,...
void sendSemanticMarkerDocFollow_mainModule(const char *SMDocFollowAddress)
sends the SM on the DOCFOLLOW channel (publish it..)
char * charSMMode_mainModule(int whichSMMode)
returns string form whichSMMode, sg "sm0", sm1 ...
char * main_currentStatusURL(boolean fullStatus)
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
void main_dispatchAsyncCommandWithString(int asyncCallCommand, char *parameter)
int getCurrentSMMode_mainModule()
returns the current SM Mode
void resetFeedCount_mainModule()
sets the feed count max
void sendMessageString_mainModule(char *messageString)
adding a synchronous call to send a message over the network (assuming MQTT but not specified),...
void setCurrentSMMode_mainModule(int whichSMMode)
sets the current screen mode .. which can be used by Button and Display processing
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 * main_nextJSONWIFICredential()
! cycle through the next WIFI saved credential
void incrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
#define SM_pair_dev
guest feed device
#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 SM_guest_feed
guest feed
#define SM_guest_page
guest page
#define NO_POWEROFF_AMOUNT_MAIN
10000 == no poweroff
#define ASYNC_SEND_MQTT_FEED_MESSAGE
sends a message (like FEED) on the users topic
#define SM_HOME_SIMPLE_LAST
#define SM_status
//status
#define ASYNC_CALL_CLEAN_CREDENTIALS
cleans out the credentials and restarts in AP (Access Point) mode.
#define ASYNC_POWEROFF
sets the GATEWAY mode off
#define SM_doc_follow
docfollow
#define SM_smart_clicker_homepage
//! homepage
#define SM_WIFI_ssid
WIFI ssid.
#define SM_ap_mode
AP MODE.
void incrementMenuState(ModelKindEnum modelKind)
increments the device states deviceState (wrapping around)
boolean invokeMenuState(ModelKindEnum modelKind)
invokes the menu state, return true if the model state has change enough to refreesh your View (such ...
ModelStateStruct * hasModelForSM_Mode(int SM_Mode)
retrieves the state model for the SM_Mode (SM_0 .. SM_LAST) null if none
void savePreferenceBoolean_mainModule(int preferenceID, boolean flag)
save a boolean preference
boolean getPreferenceBoolean_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
void togglePreferenceBoolean_mainModule(int preferenceID)
toggles a preference boolean
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 * 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
#define PREFERENCE_SENSOR_TILT_VALUE
Sensor preferences.
#define PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING
#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE
Display preferences (SemanticMarker etc) - boolean.
#define PREFERENCE_PAIRED_DEVICE_SETTING
the paired device for guest device feeding (6.6.22)
#define PREFERENCE_STEPPER_BUZZER_VALUE
stepper preferences
#define PREFERENCE_IS_MINIMAL_MENU_SETTING
sets the max temp for a poweroff
#define PREFERENCE_MAIN_GATEWAY_VALUE
void startDelay(float delayAmountSeconds)
starts delay calculation
boolean delayFinished()
whether the currently delay is finished, false if not running at all
void stopDelay()
stops delay
the struct for the models. Since this isn't straight OO, we are overlaying information....
ModelKindEnum modelKindEnum
What kind of model.