Added configuration of GPIO in UI. Added initial setup page in AP mode. Major changes in storing configuration.

This commit is contained in:
Gunnar Skjold
2020-05-03 16:29:38 +02:00
parent 1ea9da22c7
commit 2858123c1b
23 changed files with 1472 additions and 1232 deletions

View File

@@ -12,35 +12,38 @@
#include <DallasTemperature.h>
#include <OneWire.h>
#if HW_ROARFRED
#define TEMP_SENSOR_PIN 5
#elif defined(ARDUINO_LOLIN_D32)
#define TEMP_SENSOR_PIN 14
#elif defined(ARDUINO_ESP8266_WEMOS_D1MINI)
#define TEMP_SENSOR_PIN D5
#else
#define TEMP_SENSOR_PIN 0xFFFFFFFF
#endif
#define LED_INTERNAL 0
#define LED_RED 1
#define LED_GREEN 2
#define LED_BLUE 3
#define LED_YELLOW 4
class HwTools {
public:
void setTempSensorPin(int tempSensorPin);
void setVccPin(int vccPin);
void setVccMultiplier(double vccMultiplier);
double getVcc();
double getTemperature();
int getWifiRssi();
void setLed(uint8_t ledPin, bool ledInverted);
void setLedRgb(uint8_t ledPinRed, uint8_t ledPinGreen, uint8_t ledPinBlue, bool ledRgbInverted);
void ledOn(uint8_t color);
void ledOff(uint8_t color);
void ledBlink(uint8_t color, uint8_t blink);
HwTools() {
#if defined(ARDUINO_LOLIN_D32)
pinMode(GPIO_NUM_35, INPUT);
#endif
oneWire = new OneWire(TEMP_SENSOR_PIN);
tempSensor = new DallasTemperature(this->oneWire);
};
HwTools() {};
private:
uint8_t tempSensorPin = -1;
uint8_t vccPin = -1;
uint8_t ledPin = -1, ledPinRed = -1, ledPinGreen = -1, ledPinBlue = -1;
bool ledInverted, ledRgbInverted;
double vccMultiplier = 1.0;
bool tempSensorInit, hasTempSensor;
OneWire *oneWire;
DallasTemperature *tempSensor;
void writeLedPin(uint8_t color, uint8_t state);
};
#endif