Update comments GPIOViewer

This commit is contained in:
Theo Arends 2024-02-04 16:19:59 +01:00
parent 35f28fbdb8
commit 0f0a125cdb

View File

@ -13,6 +13,22 @@
* Resources: * Resources:
* GPIO Viewer: https://github.com/thelastoutpostworkshop/gpio_viewer * GPIO Viewer: https://github.com/thelastoutpostworkshop/gpio_viewer
* Server Sent Event: https://github.com/esp8266/Arduino/issues/7008 * Server Sent Event: https://github.com/esp8266/Arduino/issues/7008
* Tasmota hosted: https://ota.tasmota.com/tasmota/release-13.4.0/gpio_viewer_1_5/
*
* Supported commands:
* GvViewer - Show current viewer state
* GvViewer 0 - Turn viewer off
* GvViewer 1 - Turn viewer on
* GvViewer 2 - Toggle viewer state
* GvSampling - Show current sampling interval in milliseconds
* GvSampling 1 - Select default sampling interval (GV_SAMPLING_INTERVAL)
* GvSampling 20 .. 1000 - Set sampling interval
* GvPort - Show current port
* GvPort 1 - Select default port (GV_PORT)
* GvPort 5557 - Set port
* GvUrl - Show current url
* GvUrl 1 - Select default url (GV_BASE_URL)
* GvUrl https://thelastoutpostworkshop.github.io/microcontroller_devkit/gpio_viewer_1_5/
\*********************************************************************************************/ \*********************************************************************************************/
#define XDRV_121 121 #define XDRV_121 121
@ -21,24 +37,22 @@
#define GV_USE_ESPINFO // Provide ESP info #define GV_USE_ESPINFO // Provide ESP info
#ifdef ESP32 #ifdef ESP32
#ifndef GV_USE_ESPINFO
#define GV_USE_ESPINFO // Provide ESP info #define GV_USE_ESPINFO // Provide ESP info
#endif #endif
#endif
#ifndef GV_PORT #ifndef GV_PORT
#define GV_PORT 5557 // SSE webserver port #define GV_PORT 5557 // [GvPort] SSE webserver port
#endif #endif
#ifndef GV_SAMPLING_INTERVAL #ifndef GV_SAMPLING_INTERVAL
#define GV_SAMPLING_INTERVAL 100 // [GvSampling] milliseconds - Use Tasmota Scheduler (100) or Ticker (20..99,101..1000) #define GV_SAMPLING_INTERVAL 100 // [GvSampling] milliseconds - Use Tasmota Scheduler (100) or Ticker (20..99,101..1000)
#endif #endif
#define GV_KEEP_ALIVE 1000 // milliseconds - If no activity after this do a heap size event anyway
#ifndef GV_BASE_URL #ifndef GV_BASE_URL
#define GV_BASE_URL "https://thelastoutpostworkshop.github.io/microcontroller_devkit/gpio_viewer_1_5/" #define GV_BASE_URL "https://thelastoutpostworkshop.github.io/microcontroller_devkit/gpio_viewer_1_5/" // [GvUrl]
#endif #endif
#define GV_KEEP_ALIVE 1000 // milliseconds - If no activity after this do a heap size event anyway
const char *GVRelease = "1.5.0"; const char *GVRelease = "1.5.0";
#ifdef USE_UNISHOX_COMPRESSION #ifdef USE_UNISHOX_COMPRESSION
@ -71,8 +85,8 @@ typedef struct {
uint32_t lastSentWithNoActivity; uint32_t lastSentWithNoActivity;
uint32_t freeHeap; uint32_t freeHeap;
uint32_t freePSRAM; uint32_t freePSRAM;
uint32_t sampling; uint16_t sampling;
uint32_t init_done; uint16_t init_done;
uint16_t port; uint16_t port;
bool mutex; bool mutex;
bool sse_ready; bool sse_ready;
@ -82,7 +96,7 @@ WiFiClient GVWebClient;
#ifdef GV_INPUT_DETECTION #ifdef GV_INPUT_DETECTION
int GetPinMode(uint8_t pin) { int GetPinMode(uint32_t pin) {
#ifdef ESP8266 #ifdef ESP8266
if (pin > MAX_GPIO_PIN -2) { return -1; } // Skip GPIO16 and Analog0 if (pin > MAX_GPIO_PIN -2) { return -1; } // Skip GPIO16 and Analog0
#endif // ESP8266 #endif // ESP8266
@ -436,7 +450,7 @@ void (* const GVCommand[])(void) PROGMEM = {
void CmndGvViewer(void) { void CmndGvViewer(void) {
/* GvViewer - Show current viewer state /* GvViewer - Show current viewer state
GvViewer 0 - Turn viewer off GvViewer 0 - Turn viewer off
GvViewer 1 - Turn viewer On GvViewer 1 - Turn viewer on
GvViewer 2 - Toggle viewer state GvViewer 2 - Toggle viewer state
*/ */
GVInit(); GVInit();
@ -461,18 +475,19 @@ void CmndGvViewer(void) {
void CmndGvSampling(void) { void CmndGvSampling(void) {
/* GvSampling - Show current sampling interval /* GvSampling - Show current sampling interval
GvSampling 1 - Set default sampling interval
GvSampling 20 .. 1000 - Set sampling interval GvSampling 20 .. 1000 - Set sampling interval
*/ */
GVInit(); GVInit();
if ((XdrvMailbox.payload >= 20) && (XdrvMailbox.payload <= 1000)) { if ((SC_DEFAULT == XdrvMailbox.payload) || ((XdrvMailbox.payload >= 20) && (XdrvMailbox.payload <= 1000))) {
GVCloseEvent(); // Stop current updates GVCloseEvent(); // Stop current updates
GV->sampling = XdrvMailbox.payload; // 20 - 1000 milliseconds GV->sampling = (SC_DEFAULT == XdrvMailbox.payload) ? GV_SAMPLING_INTERVAL : XdrvMailbox.payload; // 20 - 1000 milliseconds
} }
ResponseCmndNumber(GV->sampling); ResponseCmndNumber(GV->sampling);
} }
void CmndGvPort(void) { void CmndGvPort(void) {
/* GvPort - Show vurrent port /* GvPort - Show current port
GvPort 1 - Select default port GvPort 1 - Select default port
GvPort 5557 - Set port GvPort 5557 - Set port
*/ */