Update libki
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*********************************************************************************
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-2024 Gregg E. Berman
|
||||
* Copyright (c) 2020-2025 Gregg E. Berman
|
||||
*
|
||||
* https://github.com/HomeSpan/HomeSpan
|
||||
*
|
||||
@@ -28,14 +28,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
#include "PSRAM.h"
|
||||
|
||||
[[maybe_unused]] static const char* WATCHDOG_TAG = "HomeSpan Watchdog";
|
||||
|
||||
namespace Utils {
|
||||
|
||||
char *readSerial(char *c, int max); // read serial port into 'c' until <newline>, but storing only first 'max' characters (the rest are discarded)
|
||||
String mask(char *c, int n); // simply utility that creates a String from 'c' with all except the first and last 'n' characters replaced by '*'
|
||||
char *stripBackslash(char *c); // strips backslashes out of c (Apple unecessesarily "escapes" forward slashes in JSON)
|
||||
char *stripBackslash(char *c); // strips backslashes out of c (Apple unecessesarily "escapes" forward slashes in JSON)
|
||||
const char *resetReason(); // returns literal string description of esp_reset_reason()
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
@@ -112,11 +116,11 @@ class PushButton{
|
||||
uint32_t doubleAlarm;
|
||||
uint32_t longAlarm;
|
||||
|
||||
#if SOC_TOUCH_VERSION_2
|
||||
typedef uint32_t touch_value_t;
|
||||
#else
|
||||
#if defined(SOC_TOUCH_VERSION_1) || SOC_TOUCH_SENSOR_VERSION==1
|
||||
typedef uint16_t touch_value_t;
|
||||
#endif
|
||||
#else
|
||||
typedef uint32_t touch_value_t;
|
||||
#endif
|
||||
|
||||
static touch_value_t threshold;
|
||||
static const int calibCount=20;
|
||||
@@ -145,10 +149,10 @@ class PushButton{
|
||||
static boolean TRIGGER_ON_HIGH(int pin){return(digitalRead(pin));}
|
||||
|
||||
#if SOC_TOUCH_SENSOR_NUM > 0
|
||||
#if SOC_TOUCH_VERSION_2
|
||||
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)>threshold);}
|
||||
#else
|
||||
#if defined(SOC_TOUCH_VERSION_1) || SOC_TOUCH_SENSOR_VERSION==1
|
||||
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)<threshold);}
|
||||
#else
|
||||
static boolean TRIGGER_ON_TOUCH(int pin){return(touchRead(pin)>threshold);}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -235,3 +239,21 @@ class PushButton{
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
// hsWatchdogTimer //
|
||||
////////////////////////////////
|
||||
|
||||
class hsWatchdogTimer {
|
||||
|
||||
uint16_t nSeconds=0;
|
||||
esp_task_wdt_user_handle_t wdtHandle=NULL;
|
||||
|
||||
public:
|
||||
|
||||
hsWatchdogTimer(){};
|
||||
void enable(uint16_t nSeconds);
|
||||
void disable();
|
||||
void reset();
|
||||
uint16_t getSeconds();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user