Migrated to littlefs on esp32 + fix A0 pin

This commit is contained in:
Magnus Persson 2022-03-10 11:11:39 +01:00
parent 21fba0481c
commit 2d1317af0d
3 changed files with 7 additions and 10 deletions

View File

@ -92,7 +92,7 @@ void ErrorFileLog::addEntry(String err) {
_errors[i] = _errors[i - 1];
}
_errors[0] = err;
Log.errorln(err.c_str());
Log.error(err.c_str());
save();
}
@ -232,7 +232,7 @@ void BatteryVoltage::read() {
// The analog pin can only handle 3.3V maximum voltage so we need to reduce
// the voltage (from max 5V)
float factor = myConfig.getVoltageFactor(); // Default value is 1.63
int v = analogRead(A0);
int v = analogRead(PIN_A0);
// An ESP8266 has a ADC range of 0-1023 and a maximum voltage of 3.3V
// An ESP32 has an ADC range of 0-4095 and a maximum voltage of 3.3V

View File

@ -28,22 +28,24 @@ SOFTWARE.
#include <ArduinoJson.h>
#include <ArduinoLog.h>
#include <stdlib.h>
#include <LittleFS.h>
#if defined (ESP8266)
#include <LittleFS.h>
#define ESP_RESET ESP.reset
#define PIN_SDA D3
#define PIN_SCL D4
#define PIN_DS D6
#define PIN_A0 A0
#else // defined (ESP32)
#define LittleFS SPIFFS
#include <FS.h>
#define LittleFS LITTLEFS
#define ESPhttpUpdate httpUpdate
#define ESP_RESET ESP.restart
#define ESP8266WebServer WebServer
#include <spiffs.h>
#define PIN_SDA 17
#define PIN_SCL 16
#define PIN_DS 19
#define PIN_A0 36
#endif
#define PIN_LED 2

View File

@ -39,13 +39,8 @@ SOFTWARE.
#include <wifi.hpp>
// Settings for DRD
#if defined(ESP8266)
#define ESP_DRD_USE_LITTLEFS true
#define ESP_DRD_USE_SPIFFS false
#else // defined (ESP32)
#define ESP_DRD_USE_LITTLEFS false
#define ESP_DRD_USE_SPIFFS true
#endif
#define ESP_DRD_USE_EEPROM false
#include <ESP_DoubleResetDetector.h>
#define DRD_TIMEOUT 3