mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-30 05:35:50 +00:00
Added configuration of GPIO in UI. Added initial setup page in AP mode. Major changes in storing configuration.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user