ESP_IOT v2.5
IOT ESP Coding
ButtonProcessing.cpp File Reference
#include "ButtonProcessing.h"
Include dependency graph for ButtonProcessing.cpp:

Go to the source code of this file.

Classes

struct  IMUVariables
 

Macros

#define SINGLE_DELAY
 ButtonProcessing More...
 
#define SENSORS_MOTION_PIR
 
#define PIR_PIN   36
 
#define Elapsed3secs   3000
 
#define Elapsed4secs   4000
 
#define Elapsed3mins   180000
 

Functions

void startDelay_ButtonProcessing (int seconds)
 init the delay More...
 
boolean delayFinished_ButtonProcessing ()
 if finished.. More...
 
void stopDelay_ButtonProcessing ()
 stop the delay More...
 
int getDelayNoClickPoweroffSetting ()
 get the delay values More...
 
void refreshDelayButtonTouched ()
 set when any button touched.. More...
 
void refreshDelayButtonTouched_ButtonProcessing ()
 called by the feed operation to say the device is still running.. and count it as a button click. More...
 
void checkDelaySinceButtonTouched ()
 checks delay More...
 
void toggleSM_Zoomed ()
 toggle the showing of the SemanticMarker and the ZOOM version More...
 
void invokeCurrentSemanticMarker ()
 invokes the semantic marker (which changes the display), this uses the getCurrentSMMode_mainModule() More...
 
void resetFeedCount ()
 calls the resetFeed after we figure out the max More...
 
void performProcessCurrentMode ()
 process the current command (from some button combination) This is the LONG press on the Big button A More...
 
void buzzerM5_buttonModule ()
 invokes a buzzer sound on the M5 More...
 
void buttonA_LongPress ()
 defines M5 info: https://docs.rs-online.com/e4eb/A700000008182827.pdf More...
 
void buttonA_ShortPress ()
 short press on buttonA (top button) More...
 
void checkButtonA_ButtonProcessing ()
 big button on front of M5StickC Plus More...
 
void buttonB_LongPress ()
 the long press of the side button More...
 
void buttonB_ShortPress ()
 the short press of the side button More...
 
void checkButtonB_ButtonProcessing ()
 small button on right side of M5StickC Plus More...
 
bool checkPIR_ButtonProcessing ()
 
bool checkMotion_ButtonProcessing ()
 
void setup_ButtonProcessing ()
 
void loop_ButtonProcessing ()
 the loop for buttonProcessing (extension of ButtonModule) More...
 

Variables

unsigned long _delayStart_ButtonProcessing
 the time the delay started More...
 
boolean _delayRunning_ButtonProcessing = false
 true if still waiting for delay to finish More...
 
int _delaySeconds_ButtonProcessing
 length of delay More...
 
char _smMessage [30]
 
const uint32_t SLEEP_DURATION = 1 * 1000000
 
unsigned long _PrevSampleTime = 0
 
unsigned long _PrevTriggerTime = 0
 
unsigned long _InactivityTimeOut = 0
 
struct IMUVariables _IMU
 
boolean _firstLoopProcessing = true
 

Macro Definition Documentation

◆ Elapsed3mins

#define Elapsed3mins   180000

Definition at line 715 of file ButtonProcessing.cpp.

◆ Elapsed3secs

#define Elapsed3secs   3000

Definition at line 712 of file ButtonProcessing.cpp.

◆ Elapsed4secs

#define Elapsed4secs   4000

Definition at line 713 of file ButtonProcessing.cpp.

◆ PIR_PIN

#define PIR_PIN   36

Definition at line 705 of file ButtonProcessing.cpp.

◆ SENSORS_MOTION_PIR

#define SENSORS_MOTION_PIR

Definition at line 703 of file ButtonProcessing.cpp.

◆ SINGLE_DELAY

#define SINGLE_DELAY

ButtonProcessing

3.3.22 Using the new JSON library which is supposed to catch syntax errors without blowing up class Button { public: Button(uint8_t pin, uint8_t invert, uint32_t dbTime); uint8_t read();

Definition at line 93 of file ButtonProcessing.cpp.

Function Documentation

◆ buttonA_LongPress()

void buttonA_LongPress ( )

defines M5 info: https://docs.rs-online.com/e4eb/A700000008182827.pdf

long press on buttonA (top button)

long press

buzz

Definition at line 503 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buttonA_ShortPress()

void buttonA_ShortPress ( )

short press on buttonA (top button)

These button presses are exposed so a MQTT message can invoke them.. {'set':'buttonA','val':'longpress'} {'set':'buttonA','val':'shortpress'} {'set':'buttonB','val':'longpress'} {'set':'buttonB','val':'shortpress'}

see if there is a model..

redraws the Semantic Marker image..

redraws the Semantic Marker image..

no more action .. like no feed

feed always (done after the code below..)

unfortunately, the incrementFeedCount() is AFTER the redrawSemanticMarker.. This sets the semantic marker .. which is current SM

redraws the Semantic Marker image..

Definition at line 516 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buttonB_LongPress()

void buttonB_LongPress ( )

the long press of the side button

Definition at line 592 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buttonB_ShortPress()

void buttonB_ShortPress ( )

the short press of the side button

and print any preferences to show

Definition at line 631 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buzzerM5_buttonModule()

void buzzerM5_buttonModule ( )

invokes a buzzer sound on the M5

Definition at line 471 of file ButtonProcessing.cpp.

Here is the caller graph for this function:

◆ checkButtonA_ButtonProcessing()

void checkButtonA_ButtonProcessing ( )

big button on front of M5StickC Plus

Definition at line 563 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkButtonB_ButtonProcessing()

void checkButtonB_ButtonProcessing ( )

small button on right side of M5StickC Plus

Definition at line 666 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkDelaySinceButtonTouched()

void checkDelaySinceButtonTouched ( )

checks delay

Definition at line 154 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkMotion_ButtonProcessing()

bool checkMotion_ButtonProcessing ( )

looks at M5.IMU sensor to see if changed since last time.. Return "true" on motion (over sensitivity) and false otherwise

if the TILT isn't an option.. then never return true ..

Definition at line 766 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkPIR_ButtonProcessing()

bool checkPIR_ButtonProcessing ( )

Return "true" on PIR (over sensitivity) and false otherwise This is just a sensor (if plugged in) - so any timing is on the caller of this

Definition at line 744 of file ButtonProcessing.cpp.

Here is the caller graph for this function:

◆ delayFinished_ButtonProcessing()

boolean delayFinished_ButtonProcessing ( )

if finished..

Definition at line 113 of file ButtonProcessing.cpp.

Here is the caller graph for this function:

◆ getDelayNoClickPoweroffSetting()

int getDelayNoClickPoweroffSetting ( )

get the delay values

Definition at line 133 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invokeCurrentSemanticMarker()

void invokeCurrentSemanticMarker ( )

invokes the semantic marker (which changes the display), this uses the getCurrentSMMode_mainModule()

Ths processJSONMessageMQTT( with cmd:smN } will trigger displaying the SemanticMarker for that page, etc.

Definition at line 201 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop_ButtonProcessing()

void loop_ButtonProcessing ( )

the loop for buttonProcessing (extension of ButtonModule)

Definition at line 857 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ performProcessCurrentMode()

void performProcessCurrentMode ( )

process the current command (from some button combination) This is the LONG press on the Big button A

Definition at line 224 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshDelayButtonTouched()

void refreshDelayButtonTouched ( )

set when any button touched..

Definition at line 139 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshDelayButtonTouched_ButtonProcessing()

void refreshDelayButtonTouched_ButtonProcessing ( )

called by the feed operation to say the device is still running.. and count it as a button click.

call the local implementation

Definition at line 145 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetFeedCount()

void resetFeedCount ( )

calls the resetFeed after we figure out the max

Definition at line 218 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_ButtonProcessing()

void setup_ButtonProcessing ( )

the setup for buttonProcessing (extension of ButtonModule) 在 M5StickC Plus 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。

Definition at line 830 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startDelay_ButtonProcessing()

void startDelay_ButtonProcessing ( int  seconds)

init the delay

Definition at line 103 of file ButtonProcessing.cpp.

Here is the caller graph for this function:

◆ stopDelay_ButtonProcessing()

void stopDelay_ButtonProcessing ( )

stop the delay

Definition at line 125 of file ButtonProcessing.cpp.

◆ toggleSM_Zoomed()

void toggleSM_Zoomed ( )

toggle the showing of the SemanticMarker and the ZOOM version

Definition at line 193 of file ButtonProcessing.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _delayRunning_ButtonProcessing

boolean _delayRunning_ButtonProcessing = false

true if still waiting for delay to finish

Definition at line 99 of file ButtonProcessing.cpp.

◆ _delaySeconds_ButtonProcessing

int _delaySeconds_ButtonProcessing

length of delay

Definition at line 101 of file ButtonProcessing.cpp.

◆ _delayStart_ButtonProcessing

unsigned long _delayStart_ButtonProcessing

the time the delay started

Definition at line 97 of file ButtonProcessing.cpp.

◆ _firstLoopProcessing

boolean _firstLoopProcessing = true

Definition at line 855 of file ButtonProcessing.cpp.

◆ _IMU

struct IMUVariables _IMU

◆ _InactivityTimeOut

unsigned long _InactivityTimeOut = 0

Definition at line 710 of file ButtonProcessing.cpp.

◆ _PrevSampleTime

unsigned long _PrevSampleTime = 0

Definition at line 708 of file ButtonProcessing.cpp.

◆ _PrevTriggerTime

unsigned long _PrevTriggerTime = 0

Definition at line 709 of file ButtonProcessing.cpp.

◆ _smMessage

char _smMessage[30]

Idea for the 2 buttons: (the side button is the 'select' button, which changes the "state" of the M5. Then the top button is the 'select' on the state. So if the state was "feed" then the top button would be feed.

But since their are many options for the device, th

Definition at line 190 of file ButtonProcessing.cpp.

◆ SLEEP_DURATION

const uint32_t SLEEP_DURATION = 1 * 1000000

Definition at line 706 of file ButtonProcessing.cpp.