From 0f0a125cdbd9faa6d6d46e4f4b1f10cbde640920 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 4 Feb 2024 16:19:59 +0100 Subject: [PATCH] Update comments GPIOViewer --- .../xdrv_121_gpioviewer.ino | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino b/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino index 6b782b2c7..40ab97b7f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino @@ -13,6 +13,22 @@ * Resources: * GPIO Viewer: https://github.com/thelastoutpostworkshop/gpio_viewer * 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 @@ -21,24 +37,22 @@ #define GV_USE_ESPINFO // Provide ESP info #ifdef ESP32 -#ifndef GV_USE_ESPINFO #define GV_USE_ESPINFO // Provide ESP info #endif -#endif #ifndef GV_PORT -#define GV_PORT 5557 // SSE webserver port +#define GV_PORT 5557 // [GvPort] SSE webserver port #endif #ifndef GV_SAMPLING_INTERVAL #define GV_SAMPLING_INTERVAL 100 // [GvSampling] milliseconds - Use Tasmota Scheduler (100) or Ticker (20..99,101..1000) #endif -#define GV_KEEP_ALIVE 1000 // milliseconds - If no activity after this do a heap size event anyway - #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 +#define GV_KEEP_ALIVE 1000 // milliseconds - If no activity after this do a heap size event anyway + const char *GVRelease = "1.5.0"; #ifdef USE_UNISHOX_COMPRESSION @@ -71,8 +85,8 @@ typedef struct { uint32_t lastSentWithNoActivity; uint32_t freeHeap; uint32_t freePSRAM; - uint32_t sampling; - uint32_t init_done; + uint16_t sampling; + uint16_t init_done; uint16_t port; bool mutex; bool sse_ready; @@ -82,7 +96,7 @@ WiFiClient GVWebClient; #ifdef GV_INPUT_DETECTION -int GetPinMode(uint8_t pin) { +int GetPinMode(uint32_t pin) { #ifdef ESP8266 if (pin > MAX_GPIO_PIN -2) { return -1; } // Skip GPIO16 and Analog0 #endif // ESP8266 @@ -436,7 +450,7 @@ void (* const GVCommand[])(void) PROGMEM = { void CmndGvViewer(void) { /* GvViewer - Show current viewer state GvViewer 0 - Turn viewer off - GvViewer 1 - Turn viewer On + GvViewer 1 - Turn viewer on GvViewer 2 - Toggle viewer state */ GVInit(); @@ -461,18 +475,19 @@ void CmndGvViewer(void) { void CmndGvSampling(void) { /* GvSampling - Show current sampling interval + GvSampling 1 - Set default sampling interval GvSampling 20 .. 1000 - Set sampling interval */ GVInit(); - if ((XdrvMailbox.payload >= 20) && (XdrvMailbox.payload <= 1000)) { + if ((SC_DEFAULT == XdrvMailbox.payload) || ((XdrvMailbox.payload >= 20) && (XdrvMailbox.payload <= 1000))) { 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); } void CmndGvPort(void) { - /* GvPort - Show vurrent port + /* GvPort - Show current port GvPort 1 - Select default port GvPort 5557 - Set port */