diff --git a/src/hasp_dispatch.cpp b/src/hasp_dispatch.cpp index 6a23747f..7255a41c 100644 --- a/src/hasp_dispatch.cpp +++ b/src/hasp_dispatch.cpp @@ -55,7 +55,8 @@ void dispatchOutput(int output, bool state) #elif defined(STM32F4xx) digitalWrite(HASP_OUTPUT_PIN, state); #else - analogWrite(pin, state ? 1023 : 0); + digitalWrite(D1, state); + // analogWrite(pin, state ? 1023 : 0); #endif } } diff --git a/src/hasp_gpio.cpp b/src/hasp_gpio.cpp index 4975f49d..c412482c 100644 --- a/src/hasp_gpio.cpp +++ b/src/hasp_gpio.cpp @@ -87,10 +87,10 @@ void gpioAddButton(uint8_t pin, uint8_t input_mode, uint8_t default_state, uint8 ButtonConfig * buttonConfig = button[i]->getButtonConfig(); buttonConfig->setEventHandler(gpio_event_cb); buttonConfig->setFeature(ButtonConfig::kFeatureClick); - buttonConfig->setFeature(ButtonConfig::kFeatureDoubleClick); + buttonConfig->clearFeature(ButtonConfig::kFeatureDoubleClick); buttonConfig->setFeature(ButtonConfig::kFeatureLongPress); - buttonConfig->setFeature(ButtonConfig::kFeatureRepeatPress); - buttonConfig->setFeature(ButtonConfig::kFeatureSuppressClickBeforeDoubleClick); + buttonConfig->clearFeature(ButtonConfig::kFeatureRepeatPress); + buttonConfig->clearFeature(ButtonConfig::kFeatureSuppressClickBeforeDoubleClick); // Causes annoying pauses Log.verbose(F("GPIO: Button%d created on pin %d (channel %d) mode %d default %d"), i, pin, channel, input_mode,default_state); gpioUsedInputCount = i + 1; @@ -107,7 +107,10 @@ void gpioSetup() aceButtonSetup(); //gpioConfig[0] = PD15 * 256 + 5 + (INPUT << 3); - gpioAddButton(D1, INPUT_PULLUP, HIGH, 1); +#if defined(ARDUINO_ARCH_ESP8266) + gpioAddButton(D2, INPUT_PULLUP, HIGH, 1); + pinMode(D1, OUTPUT); +#endif for(uint8_t i = 0; i < HASP_NUM_GPIO_CONFIG; i++) { uint8_t pin = (gpioConfig[i] >> 8) & 0xFF; diff --git a/src/hasp_http.cpp b/src/hasp_http.cpp index 9bb9c5ab..d6bb718c 100644 --- a/src/hasp_http.cpp +++ b/src/hasp_http.cpp @@ -1278,6 +1278,11 @@ void webHandleConfig() httpMessage += F("

"); +#if HASP_USE_GPIO > 0 + httpMessage += + F("

"); +#endif + httpMessage += F("

"); @@ -1489,9 +1494,69 @@ void webHandleHttpConfig() } #endif +//////////////////////////////////////////////////////////////////////////////////////////////////// +void webHandleGpioConfig() +{ // http://plate01/config/gpio + if(!httpIsAuthenticated(F("config/gpio"))) return; + + DynamicJsonDocument settings(256); + debugGetConfig(settings.to()); + + String httpMessage((char *)0); + httpMessage.reserve(HTTP_PAGE_SIZE); + httpMessage += F("

"); + httpMessage += httpGetNodename(); + httpMessage += F("


"); + + httpMessage += F("
"); + + uint16_t baudrate = settings[FPSTR(F_CONFIG_BAUD)].as(); + httpMessage += F("

Serial Port

Telemetry Period (Seconds, 0=disable) " + "

"); + + httpMessage += F("Syslog Hostame (optional)
Syslog Port (optional) Syslog Facility
Syslog Protocol () == 0) httpMessage += F(" checked"); + httpMessage += F(">IETF (RFC 5424)   () == 1) httpMessage += F(" checked"); + httpMessage += F(">BSD (RFC 3164)"); + + httpMessage += F("

"); + + httpMessage += + PSTR("

"); + + webSendPage(httpGetNodename(), httpMessage.length(), false); + webServer.sendContent(httpMessage); + httpMessage.clear(); + webSendFooter(); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// void webHandleDebugConfig() -{ // http://plate01/config/http +{ // http://plate01/config/debug if(!httpIsAuthenticated(F("config/debug"))) return; DynamicJsonDocument settings(256); @@ -1851,6 +1916,9 @@ void httpSetup() #endif #if HASP_USE_WIFI > 0 webServer.on(F("/config/wifi"), webHandleWifiConfig); +#endif +#if HASP_USE_GPIO > 0 + webServer.on(F("/config/gpio"), webHandleGpioConfig); #endif webServer.on(F("/screenshot"), webHandleScreenshot); webServer.on(F("/saveConfig"), webHandleSaveConfig);