mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-19 09:16:41 +00:00
Merge branch 'master' of https://github.com/HASwitchPlate/openHASP
This commit is contained in:
commit
a52ed04f1e
@ -123,7 +123,7 @@ static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t but
|
|||||||
bool state = false;
|
bool state = false;
|
||||||
switch(eventType) {
|
switch(eventType) {
|
||||||
case AceButton::kEventPressed:
|
case AceButton::kEventPressed:
|
||||||
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON) {
|
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON_TYPE) {
|
||||||
eventid = HASP_EVENT_ON;
|
eventid = HASP_EVENT_ON;
|
||||||
} else {
|
} else {
|
||||||
eventid = HASP_EVENT_DOWN;
|
eventid = HASP_EVENT_DOWN;
|
||||||
@ -146,7 +146,7 @@ static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t but
|
|||||||
// state = true; // do not repeat DOWN + LONG + HOLD
|
// state = true; // do not repeat DOWN + LONG + HOLD
|
||||||
// break;
|
// break;
|
||||||
case AceButton::kEventReleased:
|
case AceButton::kEventReleased:
|
||||||
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON) {
|
if(gpioConfig[btnid].type != hasp_gpio_type_t::BUTTON_TYPE) {
|
||||||
eventid = HASP_EVENT_OFF;
|
eventid = HASP_EVENT_OFF;
|
||||||
} else {
|
} else {
|
||||||
eventid = HASP_EVENT_RELEASE;
|
eventid = HASP_EVENT_RELEASE;
|
||||||
@ -253,7 +253,7 @@ static void gpio_setup_pin(uint8_t index)
|
|||||||
pinMode(gpio->pin, input_mode);
|
pinMode(gpio->pin, input_mode);
|
||||||
gpio->max = 0;
|
gpio->max = 0;
|
||||||
break;
|
break;
|
||||||
case hasp_gpio_type_t::BUTTON:
|
case hasp_gpio_type_t::BUTTON_TYPE:
|
||||||
if(gpio->btn) delete gpio->btn;
|
if(gpio->btn) delete gpio->btn;
|
||||||
gpio->btn = new AceButton(&buttonConfig, gpio->pin, default_state, index);
|
gpio->btn = new AceButton(&buttonConfig, gpio->pin, default_state, index);
|
||||||
gpio->power = gpio->btn->isPressedRaw();
|
gpio->power = gpio->btn->isPressedRaw();
|
||||||
@ -849,7 +849,7 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
|||||||
relay.add(gpioConfig[i].pin);
|
relay.add(gpioConfig[i].pin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON ... TOUCH:
|
case BUTTON_TYPE ... TOUCH:
|
||||||
event.add(gpioConfig[i].pin);
|
event.add(gpioConfig[i].pin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -861,7 +861,7 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
|||||||
dimmer.add(gpioConfig[i].pin);
|
dimmer.add(gpioConfig[i].pin);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case BUTTON ... TOUCH:
|
// case BUTTON_TYPE ... TOUCH:
|
||||||
case SWITCH:
|
case SWITCH:
|
||||||
strcpy_P(description, PSTR("none"));
|
strcpy_P(description, PSTR("none"));
|
||||||
break;
|
break;
|
||||||
@ -955,7 +955,7 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((gpioConfig[i].type >= hasp_gpio_type_t::SWITCH && gpioConfig[i].type <= hasp_gpio_type_t::WINDOW)) {
|
if((gpioConfig[i].type >= hasp_gpio_type_t::SWITCH && gpioConfig[i].type <= hasp_gpio_type_t::WINDOW)) {
|
||||||
// || (gpioConfig[i].type >= hasp_gpio_type_t::BUTTON && gpioConfig[i].type <= hasp_gpio_type_t::TOUCH)) {
|
// || (gpioConfig[i].type >= hasp_gpio_type_t::BUTTON_TYPE && gpioConfig[i].type <= hasp_gpio_type_t::TOUCH)) {
|
||||||
JsonArray arr = input[description];
|
JsonArray arr = input[description];
|
||||||
if(arr.isNull()) arr = input.createNestedArray(description);
|
if(arr.isNull()) arr = input.createNestedArray(description);
|
||||||
arr.add(gpioConfig[i].pin);
|
arr.add(gpioConfig[i].pin);
|
||||||
@ -1040,4 +1040,4 @@ bool gpioSetConfig(const JsonObject& settings)
|
|||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
#endif // HASP_USE_CONFIG
|
#endif // HASP_USE_CONFIG
|
||||||
|
@ -134,7 +134,7 @@ enum hasp_gpio_type_t {
|
|||||||
TAMPER = 0xBB,
|
TAMPER = 0xBB,
|
||||||
UPDATE = 0xBC,
|
UPDATE = 0xBC,
|
||||||
|
|
||||||
BUTTON = 0xF0,
|
BUTTON_TYPE = 0xF0,
|
||||||
BUTTON_TOGGLE_UP = 0xF1,
|
BUTTON_TOGGLE_UP = 0xF1,
|
||||||
BUTTON_TOGGLE_DOWN = 0xF2,
|
BUTTON_TOGGLE_DOWN = 0xF2,
|
||||||
BUTTON_TOGGLE_BOTH = 0xF3,
|
BUTTON_TOGGLE_BOTH = 0xF3,
|
||||||
@ -153,4 +153,4 @@ enum hasp_gpio_type_t {
|
|||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1804,7 +1804,7 @@ static void webHandleGpioConfig()
|
|||||||
|
|
||||||
switch(conf.type) {
|
switch(conf.type) {
|
||||||
|
|
||||||
case hasp_gpio_type_t::BUTTON:
|
case hasp_gpio_type_t::BUTTON_TYPE:
|
||||||
httpMessage += D_GPIO_BUTTON;
|
httpMessage += D_GPIO_BUTTON;
|
||||||
break;
|
break;
|
||||||
case hasp_gpio_type_t::SWITCH:
|
case hasp_gpio_type_t::SWITCH:
|
||||||
@ -2049,7 +2049,7 @@ static void webHandleGpioInput()
|
|||||||
httpMessage += F("</select></p>");
|
httpMessage += F("</select></p>");
|
||||||
|
|
||||||
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
||||||
httpMessage += getOption(hasp_gpio_type_t::BUTTON, D_GPIO_BUTTON, conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::BUTTON_TYPE, D_GPIO_BUTTON, conf.type);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::SWITCH, D_GPIO_SWITCH, conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::SWITCH, D_GPIO_SWITCH, conf.type);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::DOOR, "door", conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::DOOR, "door", conf.type);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::GARAGE_DOOR, "garage_door", conf.type);
|
httpMessage += getOption(hasp_gpio_type_t::GARAGE_DOOR, "garage_door", conf.type);
|
||||||
|
@ -1479,7 +1479,7 @@ void webHandleGpioConfig(AsyncWebServerRequest* request)
|
|||||||
|
|
||||||
switch(conf.type) {
|
switch(conf.type) {
|
||||||
|
|
||||||
case hasp_gpio_type_t::BUTTON:
|
case hasp_gpio_type_t::BUTTON_TYPE:
|
||||||
httpMessage += F(D_GPIO_BUTTON);
|
httpMessage += F(D_GPIO_BUTTON);
|
||||||
break;
|
break;
|
||||||
case hasp_gpio_type_t::SWITCH:
|
case hasp_gpio_type_t::SWITCH:
|
||||||
@ -1757,8 +1757,8 @@ void webHandleGpioInput(AsyncWebServerRequest* request)
|
|||||||
bool selected;
|
bool selected;
|
||||||
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
httpMessage += F("<p><b>Type</b> <select id='type' name='type'>");
|
||||||
|
|
||||||
selected = (conf.type == hasp_gpio_type_t::BUTTON);
|
selected = (conf.type == hasp_gpio_type_t::BUTTON_TYPE);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::BUTTON, F(D_GPIO_BUTTON), selected);
|
httpMessage += getOption(hasp_gpio_type_t::BUTTON_TYPE, F(D_GPIO_BUTTON), selected);
|
||||||
|
|
||||||
selected = (conf.type == hasp_gpio_type_t::SWITCH);
|
selected = (conf.type == hasp_gpio_type_t::SWITCH);
|
||||||
httpMessage += getOption(hasp_gpio_type_t::SWITCH, F(D_GPIO_SWITCH), selected);
|
httpMessage += getOption(hasp_gpio_type_t::SWITCH, F(D_GPIO_SWITCH), selected);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
;***************************************************;
|
;***************************************************;
|
||||||
|
|
||||||
[env:huzzah32-v2-featherwing-35-v2]
|
[env:huzzah32-v2-featherwing-35-v2]
|
||||||
extends = arduino_esp32_v2, flash_4mb
|
extends = arduino_esp32_v2, flash_8mb
|
||||||
board = featheresp32
|
board = adafruit_feather_esp32_v2
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
-D HASP_MODEL="Adafruit HUZZAH32 V2 ESP32 Featherwing 3.5 V2"
|
-D HASP_MODEL="Adafruit HUZZAH32 V2 ESP32 Featherwing 3.5 V2"
|
||||||
@ -16,13 +16,14 @@ build_flags =
|
|||||||
-D LV_INDEV_DEF_READ_PERIOD=30
|
-D LV_INDEV_DEF_READ_PERIOD=30
|
||||||
;region -- TFT_eSPI build options ------------------------
|
;region -- TFT_eSPI build options ------------------------
|
||||||
${lcd.featherwing-35-v2}
|
${lcd.featherwing-35-v2}
|
||||||
-D TFT_MISO=19
|
-D TFT_MISO=21 ; GPIO21 / MISO
|
||||||
-D TFT_MOSI=18
|
-D TFT_MOSI=19 ; GPIO19 / MOSI
|
||||||
-D TFT_SCLK=5
|
-D TFT_SCLK=5 ; GPIO5 / SCK
|
||||||
-D TFT_DC=10
|
-D TFT_DC=33 ; GPIO33 / D33
|
||||||
-D TFT_CS=9
|
-D TFT_CS=15 ; GPIO15 / D15
|
||||||
-D TFT_RST=-1 ; RST
|
-D TFT_RST=-1 ; RST
|
||||||
-D TFT_BCKL=21 ; Solder the LITE pad to a PWM enabled pin of the ESP, like GPIO 21
|
|
||||||
|
-D TFT_BCKL=37 ; Solder the LITE pad to a PWM enabled pin of the ESP, like GPIO 21
|
||||||
;endregion
|
;endregion
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user