Small changes

This commit is contained in:
fvanroie 2020-05-21 23:14:39 +02:00
parent 7ae06e8b6d
commit 22adeb55eb
2 changed files with 24 additions and 25 deletions

View File

@ -16,7 +16,8 @@ uint16_t gpioConfig[HASP_NUM_GPIO_CONFIG];
using namespace ace_button;
static AceButton * button[HASP_NUM_INPUTS];
struct hasp_gpio_config_t {
struct hasp_gpio_config_t
{
const uint8_t pin;
const uint8_t group;
const uint8_t io_mode;
@ -26,11 +27,7 @@ struct hasp_gpio_config_t {
// An array of button pins, led pins, and the led states. Cannot be const
// because ledState is mutable.
hasp_gpio_config_t gpioConfig2[HASP_NUM_GPIO_CONFIG] = {
{2, 8, INPUT, LOW},
{3, 9, OUTPUT, LOW},
{4, 10, INPUT, HIGH},
{5, 11, OUTPUT, LOW},
{6, 12, INPUT, LOW},
{2, 8, INPUT, LOW}, {3, 9, OUTPUT, LOW}, {4, 10, INPUT, HIGH}, {5, 11, OUTPUT, LOW}, {6, 12, INPUT, LOW},
};
#if defined(ARDUINO_ARCH_ESP32)
@ -116,7 +113,6 @@ void IRAM_ATTR gpioLoop(void)
void gpioAddButton(uint8_t pin, uint8_t input_mode, uint8_t default_state, uint8_t channel)
{
uint8_t i;
for(i = 0; i < HASP_NUM_INPUTS; i++) {
@ -182,15 +178,17 @@ void gpioSetup()
{
aceButtonSetup();
return;
// gpioConfig[0] = PD15 * 256 + 5 + (INPUT << 3);
#if defined(ARDUINO_ARCH_ESP8266)
gpioAddButton(D2, INPUT_PULLUP, HIGH, 1);
pinMode(D1, OUTPUT);
//pinMode(D1, OUTPUT);
#endif
#if defined(ARDUINO_ARCH_ESP32)
gpioAddButton( D2, INPUT, HIGH, 1);
pinMode(D1, OUTPUT);
// gpioAddButton(D2, INPUT, HIGH, 1);
// pinMode(D1, OUTPUT);
#endif
for(uint8_t i = 0; i < HASP_NUM_GPIO_CONFIG; i++) {
@ -220,7 +218,8 @@ void gpioSetup()
switch(gpiotype) {
case HASP_GPIO_SWITCH:
case HASP_GPIO_BUTTON:
// gpioAddButton(gpioConfig[i].io_mode.pin, input_mode, gpioConfig[i].default_state, gpioConfig[i].group);
// gpioAddButton(gpioConfig[i].io_mode.pin, input_mode, gpioConfig[i].default_state,
// gpioConfig[i].group);
break;
case HASP_GPIO_RELAY:

View File

@ -45,7 +45,7 @@ char httpUser[32] = "";
char httpPassword[32] = "";
#define HTTP_PAGE_SIZE (6 * 256)
#if defined(STM32F4xx)
#if defined(STM32F4xx) && HASP_USE_ETHERNET>0
#include <EthernetWebServer_STM32.h>
EthernetWebServer webServer(80);
#endif