Add Timeout / Notification on "forgot to turn off"
control: - reset timeout on user input only -> drop reset on changed motor duty - add timeoutNotifyPowerStillOnMs -> when forgotten to turn off the power the buzzer beeps a few times every 30 minutes - Add/fix JOYSTICK_LOG_IN_IDLE option remove empty config.hpp
This commit is contained in:
parent
3aa6bcc403
commit
bc9504d4ab
@ -1,7 +1,6 @@
|
||||
idf_component_register(
|
||||
SRCS
|
||||
"main.cpp"
|
||||
"config.cpp"
|
||||
"control.cpp"
|
||||
"button.cpp"
|
||||
"fan.cpp"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "auto.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
//tag for logging
|
||||
static const char * TAG = "automatedArmchair";
|
||||
|
@ -100,9 +100,10 @@ void buttonCommands::action (uint8_t count, bool lastPressLong){
|
||||
control->changeMode(controlMode_t::ADJUST_CHAIR);
|
||||
}
|
||||
// ## toggle IDLE ##
|
||||
else {
|
||||
else
|
||||
{
|
||||
ESP_LOGW(TAG, "cmd %d: toggle IDLE", count);
|
||||
control->toggleIdle(); //toggle between idle and previous/default mode
|
||||
control->toggleIdle(); // toggle between idle and previous/default mode
|
||||
}
|
||||
break;
|
||||
|
||||
@ -155,7 +156,7 @@ void buttonCommands::action (uint8_t count, bool lastPressLong){
|
||||
// when not in MENU mode, repeatedly receives events from encoder button
|
||||
// and takes the corresponding action
|
||||
// this function has to be started once in a separate task
|
||||
#define INPUT_TIMEOUT 800 // duration of no button events, after which action is run (implicitly also is 'long-press' time)
|
||||
#define INPUT_TIMEOUT 700 // duration of no button events, after which action is run (implicitly also is 'long-press' time)
|
||||
void buttonCommands::startHandleLoop()
|
||||
{
|
||||
//-- variables --
|
||||
@ -178,7 +179,7 @@ void buttonCommands::startHandleLoop()
|
||||
//-- get events from encoder --
|
||||
if (xQueueReceive(encoderQueue, &ev, INPUT_TIMEOUT / portTICK_PERIOD_MS))
|
||||
{
|
||||
control->resetTimeout(); //reset inactivity IDLE timeout
|
||||
control->resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
switch (ev.type)
|
||||
{
|
||||
break;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "control.hpp"
|
||||
#include "motorctl.hpp"
|
||||
#include "auto.hpp"
|
||||
#include "config.hpp"
|
||||
#include "joystick.hpp"
|
||||
|
||||
|
||||
|
@ -121,11 +121,9 @@ motorctl_config_t configMotorControlRight = {
|
||||
//------------------------------
|
||||
control_config_t configControl = {
|
||||
.defaultMode = controlMode_t::JOYSTICK, // default mode after startup and toggling IDLE
|
||||
//--- timeout ---
|
||||
.timeoutMs = 3 * 60 * 1000, // time of inactivity after which the mode gets switched to IDLE
|
||||
.timeoutTolerancePer = 5, // percentage the duty can vary between timeout checks considered still inactive
|
||||
//--- http mode ---
|
||||
|
||||
//--- timeouts ---
|
||||
.timeoutSwitchToIdleMs = 5 * 60 * 1000, // time of inactivity after which the mode gets switched to IDLE
|
||||
.timeoutNotifyPowerStillOnMs = 6 * 60 * 60 * 1000 // time in IDLE after which buzzer beeps in certain interval (notify "forgot to turn off")
|
||||
};
|
||||
|
||||
//-------------------------------
|
||||
|
6
board_single/main/config.h
Normal file
6
board_single/main/config.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
// outsourced macros / definitions
|
||||
|
||||
//-- control.cpp --
|
||||
//#define JOYSTICK_LOG_IN_IDLE
|
@ -1,57 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "motordrivers.hpp"
|
||||
#include "motorctl.hpp"
|
||||
#include "joystick.hpp"
|
||||
|
||||
#include "gpio_evaluateSwitch.hpp"
|
||||
#include "buzzer.hpp"
|
||||
#include "control.hpp"
|
||||
#include "fan.hpp"
|
||||
#include "http.hpp"
|
||||
#include "auto.hpp"
|
||||
#include "speedsensor.hpp"
|
||||
#include "chairAdjust.hpp"
|
||||
|
||||
//
|
||||
////in IDLE mode: set loglevel for evaluatedJoystick to DEBUG
|
||||
////and repeatedly read joystick e.g. for manually calibrating / testing joystick
|
||||
////#define JOYSTICK_LOG_IN_IDLE
|
||||
//
|
||||
//
|
||||
////TODO outsource global variables to e.g. global.cpp and only config options here?
|
||||
//
|
||||
////create global controlledMotor instances for both motors
|
||||
//extern controlledMotor motorLeft;
|
||||
//extern controlledMotor motorRight;
|
||||
//
|
||||
////create global joystic instance
|
||||
//extern evaluatedJoystick joystick;
|
||||
//
|
||||
////create global evaluated switch instance for button next to joystick
|
||||
//extern gpio_evaluatedSwitch buttonJoystick;
|
||||
//
|
||||
////create global buzzer object
|
||||
//extern buzzer_t buzzer;
|
||||
//
|
||||
////create global control object
|
||||
//extern controlledArmchair control;
|
||||
//
|
||||
////create global automatedArmchair object (for auto-mode)
|
||||
//extern automatedArmchair_c armchair;
|
||||
//
|
||||
////create global httpJoystick object
|
||||
////extern httpJoystick httpJoystickMain;
|
||||
//
|
||||
////configuration for fans / cooling
|
||||
//extern fan_config_t configCooling;
|
||||
//
|
||||
////create global objects for measuring speed
|
||||
//extern speedSensor speedLeft;
|
||||
//extern speedSensor speedRight;
|
||||
//
|
||||
////create global objects for controlling the chair position
|
||||
//extern cControlledRest legRest;
|
||||
//extern cControlledRest backRest;
|
||||
//
|
||||
//
|
@ -9,13 +9,13 @@ extern "C"
|
||||
#include "wifi.h"
|
||||
}
|
||||
|
||||
#include "config.hpp"
|
||||
#include "config.h"
|
||||
#include "control.hpp"
|
||||
#include "chairAdjust.hpp"
|
||||
|
||||
|
||||
//used definitions moved from config.hpp:
|
||||
//#define JOYSTICK_TEST
|
||||
//used definitions moved from config.h:
|
||||
//#define JOYSTICK_LOG_IN_IDLE
|
||||
|
||||
|
||||
//tag for logging
|
||||
@ -70,7 +70,6 @@ controlledArmchair::controlledArmchair(
|
||||
void task_control( void * pvParameters ){
|
||||
controlledArmchair * control = (controlledArmchair *)pvParameters;
|
||||
ESP_LOGW(TAG, "Initializing controlledArmchair and starting handle loop");
|
||||
//start handle loop (control object declared in config.hpp)
|
||||
control->startHandleLoop();
|
||||
}
|
||||
|
||||
@ -95,13 +94,15 @@ void controlledArmchair::startHandleLoop() {
|
||||
//motorLeft->setTarget(commands.left.state, commands.left.duty);
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
#ifdef JOYSTICK_LOG_IN_IDLE
|
||||
//get joystick data here (without using it)
|
||||
//since loglevel is DEBUG, calculation details are output
|
||||
joystick_l->getData();
|
||||
// get joystick data and log it
|
||||
joystickData_t data joystick_l->getData();
|
||||
ESP_LOGI("JOYSTICK_LOG_IN_IDLE", "x=%.3f, y=%.3f, radius=%.3f, angle=%.3f, pos=%s, adcx=%d, adcy=%d",
|
||||
data.x, data.y, data.radius, data.angle,
|
||||
joystickPosStr[(int)data.position],
|
||||
objects->joystick->getRawX(), objects->joystick->getRawY());
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
//------- handle JOYSTICK mode -------
|
||||
case controlMode_t::JOYSTICK:
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
//get current joystick data with getData method of evaluatedJoystick
|
||||
@ -113,6 +114,7 @@ void controlledArmchair::startHandleLoop() {
|
||||
// only generate when the stick data actually changed (e.g. stick stayed in center)
|
||||
if (stickData.x != stickDataLast.x || stickData.y != stickDataLast.y)
|
||||
{
|
||||
resetTimeout(); //user input -> reset switch to IDLE timeout
|
||||
commands = joystick_generateCommandsDriving(stickData, &joystickGenerateCommands_config);
|
||||
// apply motor commands
|
||||
motorRight->setTarget(commands.right);
|
||||
@ -121,27 +123,34 @@ void controlledArmchair::startHandleLoop() {
|
||||
else
|
||||
{
|
||||
vTaskDelay(20 / portTICK_PERIOD_MS);
|
||||
ESP_LOGD(TAG, "analog joystick data unchanged at %s not updating commands", joystickPosStr[(int)stickData.position]);
|
||||
ESP_LOGV(TAG, "analog joystick data unchanged at %s not updating commands", joystickPosStr[(int)stickData.position]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
//------- handle MASSAGE mode -------
|
||||
case controlMode_t::MASSAGE:
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
//--- read joystick ---
|
||||
//only update joystick data when input not frozen
|
||||
if (!freezeInput){
|
||||
// only update joystick data when input not frozen
|
||||
stickDataLast = stickData;
|
||||
if (!freezeInput)
|
||||
stickData = joystick_l->getData();
|
||||
}
|
||||
//--- generate motor commands ---
|
||||
//pass joystick data from getData method of evaluatedJoystick to generateCommandsShaking function
|
||||
// only generate when the stick data actually changed (e.g. stick stayed in center)
|
||||
if (stickData.x != stickDataLast.x || stickData.y != stickDataLast.y)
|
||||
{
|
||||
resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
// pass joystick data from getData method of evaluatedJoystick to generateCommandsShaking function
|
||||
commands = joystick_generateCommandsShaking(stickData);
|
||||
//apply motor commands
|
||||
// apply motor commands
|
||||
motorRight->setTarget(commands.right);
|
||||
motorLeft->setTarget(commands.left);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
//------- handle HTTP mode -------
|
||||
case controlMode_t::HTTP:
|
||||
//--- get joystick data from queue ---
|
||||
stickDataLast = stickData;
|
||||
@ -152,6 +161,7 @@ void controlledArmchair::startHandleLoop() {
|
||||
//--- generate motor commands ---
|
||||
//only generate when the stick data actually changed (e.g. no new data recevied via http)
|
||||
if (stickData.x != stickDataLast.x || stickData.y != stickDataLast.y ){
|
||||
resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
// Note: timeout (no data received) is handled in getData method
|
||||
commands = joystick_generateCommandsDriving(stickData, &joystickGenerateCommands_config);
|
||||
|
||||
@ -166,6 +176,7 @@ void controlledArmchair::startHandleLoop() {
|
||||
break;
|
||||
|
||||
|
||||
//------- handle AUTO mode -------
|
||||
case controlMode_t::AUTO:
|
||||
vTaskDelay(20 / portTICK_PERIOD_MS);
|
||||
//generate commands
|
||||
@ -206,26 +217,26 @@ void controlledArmchair::startHandleLoop() {
|
||||
break;
|
||||
|
||||
|
||||
//------- handle ADJUST_CHAIR mode -------
|
||||
case controlMode_t::ADJUST_CHAIR:
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
//--- read joystick ---
|
||||
stickDataLast = stickData;
|
||||
stickData = joystick_l->getData();
|
||||
//--- idle motors ---
|
||||
//commands = cmds_bothMotorsIdle; - now done once at mode change
|
||||
//motorRight->setTarget(commands.right.state, commands.right.duty);
|
||||
//motorLeft->setTarget(commands.left.state, commands.left.duty);
|
||||
//--- control armchair position with joystick input ---
|
||||
// dont update when stick data did not change
|
||||
if (stickData.x != stickDataLast.x || stickData.y != stickDataLast.y)
|
||||
{
|
||||
resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
controlChairAdjustment(joystick_l->getData(), legRest, backRest);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
//------- handle MENU mode -------
|
||||
case controlMode_t::MENU:
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
//nothing to do here, display task handles the menu
|
||||
//--- idle motors ---
|
||||
//commands = cmds_bothMotorsIdle; - now done once at mode change
|
||||
//motorRight->setTarget(commands.right.state, commands.right.duty);
|
||||
//motorLeft->setTarget(commands.left.state, commands.left.duty);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
break;
|
||||
|
||||
//TODO: add other modes here
|
||||
@ -238,8 +249,7 @@ void controlledArmchair::startHandleLoop() {
|
||||
if (esp_log_timestamp() - timestamp_SlowLoopLastRun > 5000) {
|
||||
ESP_LOGV(TAG, "running slow loop... time since last run: %.1fs", (float)(esp_log_timestamp() - timestamp_SlowLoopLastRun)/1000);
|
||||
timestamp_SlowLoopLastRun = esp_log_timestamp();
|
||||
|
||||
//run function that detects timeout (switch to idle)
|
||||
//run function that detects timeout (switch to idle, or notify "forgot to turn off")
|
||||
handleTimeout();
|
||||
}
|
||||
|
||||
@ -310,59 +320,52 @@ void controlledArmchair::idleBothMotors(){
|
||||
motorLeft->setTarget(cmd_motorIdle);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------
|
||||
//---------- resetTimeout -----------
|
||||
//-----------------------------------
|
||||
void controlledArmchair::resetTimeout(){
|
||||
//TODO mutex
|
||||
timestamp_lastActivity = esp_log_timestamp();
|
||||
ESP_LOGV(TAG, "timeout: activity detected, resetting timeout");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------
|
||||
//---------- handleTimeout -----------
|
||||
//------------------------------------
|
||||
//percentage the duty can vary since last timeout check and still counts as incative
|
||||
//TODO: add this to config
|
||||
float inactivityTolerance = 10;
|
||||
// switch to IDLE when no activity (prevent accidential movement)
|
||||
// notify "power still on" when in IDLE for a very long time (prevent battery drain when forgotten to turn off)
|
||||
// this function has to be run repeatedly (can be slow interval)
|
||||
#define TIMEOUT_POWER_STILL_ON_BEEP_INTERVAL_MS 30 * 60 * 1000 // beep every 30 minutes for someone to notice
|
||||
// note: timeout durations are configured in config.cpp
|
||||
void controlledArmchair::handleTimeout()
|
||||
{
|
||||
uint32_t noActivityDurationMs = esp_log_timestamp() - timestamp_lastActivity;
|
||||
// log current inactivity and configured timeouts
|
||||
ESP_LOGD(TAG, "timeout check: last activity %dmin and %ds ago - timeout IDLE after %ds - notify after power on after %dh",
|
||||
noActivityDurationMs / 1000 / 60,
|
||||
noActivityDurationMs / 1000 % 60,
|
||||
config.timeoutSwitchToIdleMs / 1000,
|
||||
config.timeoutNotifyPowerStillOnMs / 1000);
|
||||
|
||||
//local function that checks whether two values differ more than a given tolerance
|
||||
bool validateActivity(float dutyOld, float dutyNow, float tolerance){
|
||||
float dutyDelta = dutyNow - dutyOld;
|
||||
if (fabs(dutyDelta) < tolerance) {
|
||||
return false; //no significant activity detected
|
||||
} else {
|
||||
return true; //there was activity
|
||||
// timeout to IDLE when not idling already
|
||||
if (mode != controlMode_t::IDLE && noActivityDurationMs > config.timeoutSwitchToIdleMs)
|
||||
{
|
||||
ESP_LOGW(TAG, "timeout check: [TIMEOUT], no activity for more than %ds -> switch to IDLE", config.timeoutSwitchToIdleMs / 1000);
|
||||
changeMode(controlMode_t::IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
//function that evaluates whether there is no activity/change on the motor duty for a certain time. If so, a switch to IDLE is issued. - has to be run repeatedly in a slow interval
|
||||
void controlledArmchair::handleTimeout(){
|
||||
//check for timeout only when not idling already
|
||||
if (mode != controlMode_t::IDLE) {
|
||||
//get current duty from controlled motor objects
|
||||
float dutyLeftNow = motorLeft->getStatus().duty;
|
||||
float dutyRightNow = motorRight->getStatus().duty;
|
||||
|
||||
//activity detected on any of the two motors
|
||||
if (validateActivity(dutyLeft_lastActivity, dutyLeftNow, inactivityTolerance)
|
||||
|| validateActivity(dutyRight_lastActivity, dutyRightNow, inactivityTolerance)
|
||||
){
|
||||
ESP_LOGD(TAG, "timeout check: [activity] detected since last check -> reset");
|
||||
//reset last duty and timestamp
|
||||
dutyLeft_lastActivity = dutyLeftNow;
|
||||
dutyRight_lastActivity = dutyRightNow;
|
||||
resetTimeout();
|
||||
}
|
||||
//no activity on any motor and msTimeout exceeded
|
||||
else if (esp_log_timestamp() - timestamp_lastActivity > config.timeoutMs){
|
||||
ESP_LOGI(TAG, "timeout check: [TIMEOUT], no activity for more than %.ds -> switch to idle", config.timeoutMs/1000);
|
||||
//toggle to idle mode
|
||||
toggleIdle();
|
||||
}
|
||||
else {
|
||||
ESP_LOGD(TAG, "timeout check: [inactive], last activity %.1f s ago, timeout after %d s", (float)(esp_log_timestamp() - timestamp_lastActivity)/1000, config.timeoutMs/1000);
|
||||
// repeatedly notify via buzzer when in IDLE for a very long time to prevent battery drain ("forgot to turn off")
|
||||
// note: ignores user input while in IDLE
|
||||
else if (esp_log_timestamp() - timestamp_lastModeChange > config.timeoutNotifyPowerStillOnMs)
|
||||
{
|
||||
// beep in certain intervals
|
||||
if (esp_log_timestamp() - timestamp_lastTimeoutBeep > TIMEOUT_POWER_STILL_ON_BEEP_INTERVAL_MS)
|
||||
{
|
||||
ESP_LOGD(TAG, "timeout: [TIMEOUT] in IDLE for more than %.3f hours", (float)(esp_log_timestamp() - timestamp_lastModeChange) / 1000 / 60 / 60);
|
||||
// TODO dont beep at certain times ranges (e.g. at night)
|
||||
timestamp_lastTimeoutBeep = esp_log_timestamp();
|
||||
buzzer->beep(4, 100, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -385,6 +388,8 @@ void controlledArmchair::changeMode(controlMode_t modeNew) {
|
||||
|
||||
//copy previous mode
|
||||
modePrevious = mode;
|
||||
//store time changed (needed for timeout)
|
||||
timestamp_lastModeChange = esp_log_timestamp();
|
||||
|
||||
ESP_LOGW(TAG, "=== changing mode from %s to %s ===", controlModeStr[(int)mode], controlModeStr[(int)modeNew]);
|
||||
|
||||
@ -448,9 +453,6 @@ void controlledArmchair::changeMode(controlMode_t modeNew) {
|
||||
ESP_LOGW(TAG, "switching to IDLE mode: turning both motors off, beep");
|
||||
idleBothMotors();
|
||||
buzzer->beep(1, 900, 0);
|
||||
#ifdef JOYSTICK_LOG_IN_IDLE
|
||||
esp_log_level_set("evaluatedJoystick", ESP_LOG_DEBUG);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case controlMode_t::ADJUST_CHAIR:
|
||||
@ -540,9 +542,9 @@ void controlledArmchair::toggleMode(controlMode_t modePrimary){
|
||||
|
||||
|
||||
|
||||
//-------------------------------
|
||||
//------ loadDecelDuration ------
|
||||
//-------------------------------
|
||||
//-----------------------------
|
||||
//-------- loadMaxDuty --------
|
||||
//-----------------------------
|
||||
// update local config value when maxDuty is stored in nvs
|
||||
void controlledArmchair::loadMaxDuty(void)
|
||||
{
|
||||
|
@ -27,7 +27,8 @@ extern const char* controlModeStr[9];
|
||||
typedef struct control_config_t {
|
||||
controlMode_t defaultMode; //default mode after startup and toggling IDLE
|
||||
//timeout options
|
||||
uint32_t timeoutMs; //time of inactivity after which the mode gets switched to IDLE
|
||||
uint32_t timeoutSwitchToIdleMs; //time of inactivity after which the mode gets switched to IDLE
|
||||
uint32_t timeoutNotifyPowerStillOnMs;
|
||||
float timeoutTolerancePer; //percentage the duty can vary between timeout checks considered still inactive
|
||||
} control_config_t;
|
||||
|
||||
@ -169,10 +170,10 @@ class controlledArmchair {
|
||||
//variable for slow loop
|
||||
uint32_t timestamp_SlowLoopLastRun = 0;
|
||||
|
||||
//variables for detecting timeout (switch to idle, after inactivity)
|
||||
float dutyLeft_lastActivity = 0;
|
||||
float dutyRight_lastActivity = 0;
|
||||
//variables for detecting timeout (switch to idle, or notify "forgot to turn off" after inactivity
|
||||
uint32_t timestamp_lastModeChange = 0;
|
||||
uint32_t timestamp_lastActivity = 0;
|
||||
uint32_t timestamp_lastTimeoutBeep = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@ extern "C"
|
||||
#include "motorctl.hpp"
|
||||
|
||||
//folder single_board
|
||||
#include "config.hpp"
|
||||
#include "control.hpp"
|
||||
#include "button.hpp"
|
||||
#include "display.hpp"
|
||||
|
@ -11,7 +11,6 @@ extern "C"{
|
||||
|
||||
#include "menu.hpp"
|
||||
#include "encoder.hpp"
|
||||
#include "config.hpp"
|
||||
#include "motorctl.hpp"
|
||||
|
||||
|
||||
@ -105,7 +104,7 @@ void item_calibrateJoystick_action(display_task_parameters_t *objects, SSD1306_t
|
||||
// save and next when button clicked, exit when long pressed
|
||||
if (xQueueReceive(objects->encoderQueue, &event, CALIBRATE_JOYSTICK_UPDATE_INTERVAL / portTICK_PERIOD_MS))
|
||||
{
|
||||
objects->control->resetTimeout();
|
||||
objects->control->resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
switch (event.type)
|
||||
{
|
||||
case RE_ET_BTN_CLICKED:
|
||||
@ -215,7 +214,7 @@ void item_debugJoystick_action(display_task_parameters_t * objects, SSD1306_t *
|
||||
// exit when button pressed
|
||||
if (xQueueReceive(objects->encoderQueue, &event, DEBUG_JOYSTICK_UPDATE_INTERVAL / portTICK_PERIOD_MS))
|
||||
{
|
||||
objects->control->resetTimeout();
|
||||
objects->control->resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
switch (event.type)
|
||||
{
|
||||
case RE_ET_BTN_CLICKED:
|
||||
@ -621,7 +620,7 @@ void handleMenu(display_task_parameters_t * objects, SSD1306_t *display)
|
||||
{
|
||||
// reset menu- and control-timeout on any encoder event
|
||||
lastActivity = esp_log_timestamp();
|
||||
objects->control->resetTimeout();
|
||||
objects->control->resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
switch (event.type)
|
||||
{
|
||||
case RE_ET_CHANGED:
|
||||
@ -692,7 +691,7 @@ void handleMenu(display_task_parameters_t * objects, SSD1306_t *display)
|
||||
// wait for encoder event
|
||||
if (xQueueReceive(objects->encoderQueue, &event, QUEUE_TIMEOUT / portTICK_PERIOD_MS))
|
||||
{
|
||||
objects->control->resetTimeout();
|
||||
objects->control->resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
switch (event.type)
|
||||
{
|
||||
case RE_ET_CHANGED:
|
||||
@ -732,7 +731,7 @@ void handleMenu(display_task_parameters_t * objects, SSD1306_t *display)
|
||||
}
|
||||
// reset menu- and control-timeout on any encoder event
|
||||
lastActivity = esp_log_timestamp();
|
||||
objects->control->resetTimeout();
|
||||
objects->control->resetTimeout(); // user input -> reset switch to IDLE timeout
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user