ESP8266 compatibility
This commit is contained in:
parent
d29cb632ec
commit
ca36d71288
@ -3,4 +3,14 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
#include <WiFi.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
#include <nvs_flash.h>
|
||||
#include <Preferences.h>
|
||||
|
||||
Preferences config;
|
||||
|
||||
@ -47,3 +51,31 @@ double configGetDouble(const char *name, double fallback) {
|
||||
bool configPutDouble(const char *name, double fallback) {
|
||||
return config.value(name, fallback) == 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void configSetup() {
|
||||
// ESP8266 FAKE
|
||||
}
|
||||
|
||||
void configReset() {
|
||||
// ESP8266 FAKE
|
||||
}
|
||||
|
||||
String configGetString(const char *name, const char *fallback, bool allowEmpty) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
bool configPutString(const char *name, const char *value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double configGetDouble(const char *name, double fallback) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
bool configPutDouble(const char *name, double fallback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef SENSOR3_CONFIG_H
|
||||
#define SENSOR3_CONFIG_H
|
||||
|
||||
#include <Preferences.h>
|
||||
#include <WString.h>
|
||||
|
||||
void configSetup();
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#include <console.h>
|
||||
#include <HardwareSerial.h>
|
||||
#include <log.h>
|
||||
#include <Esp.h>
|
||||
#include <WiFi.h>
|
||||
#include "base.h"
|
||||
#include "mqtt.h"
|
||||
#include "wifi.h"
|
||||
#include "config.h"
|
||||
@ -167,8 +166,10 @@ void _info() {
|
||||
info(" sys: %s", datetime);
|
||||
|
||||
info("Chip:");
|
||||
#ifdef ESP32
|
||||
info(" model: %s", ESP.getChipModel());
|
||||
info(" cores: %d", ESP.getChipCores());
|
||||
#endif
|
||||
info(" freq: %d", ESP.getCpuFreqMHz());
|
||||
|
||||
info("Flash:");
|
||||
@ -177,20 +178,24 @@ void _info() {
|
||||
info(" speed: %d", ESP.getFlashChipSpeed());
|
||||
|
||||
info("Heap:");
|
||||
info(" size: %d", ESP.getHeapSize());
|
||||
info(" free: %d", ESP.getFreeHeap());
|
||||
#ifdef ESP32
|
||||
info(" size: %d", ESP.getHeapSize());
|
||||
info(" minFree: %d", ESP.getMinFreeHeap());
|
||||
info(" maxAlloc: %d", ESP.getMaxAllocHeap());
|
||||
#endif
|
||||
|
||||
info("PS RAM:");
|
||||
info(" size: %d", ESP.getPsramSize());
|
||||
#ifdef ESP32
|
||||
info(" free: %d", ESP.getFreePsram());
|
||||
info(" size: %d", ESP.getPsramSize());
|
||||
info(" minFree: %d", ESP.getMinFreePsram());
|
||||
info(" maxAlloc: %d", ESP.getMaxAllocPsram());
|
||||
#endif
|
||||
|
||||
info("SDK:");
|
||||
info(" size: %d", ESP.getSketchSize());
|
||||
info(" free: %d", ESP.getFreeSketchSpace());
|
||||
info(" size: %d", ESP.getSketchSize());
|
||||
info(" MD5: %s", ESP.getSketchMD5().c_str());
|
||||
|
||||
info("SDK:");
|
||||
@ -207,10 +212,12 @@ const char *getFlashChipMode() {
|
||||
return "DIO";
|
||||
case FM_DOUT:
|
||||
return "DOUT";
|
||||
case FM_FAST_READ:
|
||||
return "FAST_READ";
|
||||
case FM_SLOW_READ:
|
||||
return "SLOW_READ";
|
||||
#ifdef ESP32
|
||||
case FM_FAST_READ:
|
||||
return "FAST_READ";
|
||||
case FM_SLOW_READ:
|
||||
return "SLOW_READ";
|
||||
#endif
|
||||
case FM_UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
default:
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#include "wifi.h"
|
||||
#include "base.h"
|
||||
#include "log.h"
|
||||
#include "mqtt.h"
|
||||
#include "console.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <lwip/apps/sntp.h>
|
||||
|
||||
@ -61,7 +61,11 @@ void wifiConnect() {
|
||||
|
||||
info("WIFI connecting: %s", ssid.c_str());
|
||||
|
||||
#ifdef ESP32
|
||||
WiFiClass::hostname(HOSTNAME);
|
||||
#else
|
||||
WiFi.hostname(HOSTNAME);
|
||||
#endif
|
||||
yield();
|
||||
|
||||
WiFi.begin(ssid, pkey);
|
||||
|
||||
@ -32,13 +32,13 @@ lib_deps = ${COMMON.lib_deps}
|
||||
build_flags = -D HOSTNAME=\"DEV\" -D WIFI_SSID=\"${COMMON.WIFI_SSID}\" -D WIFI_PKEY=\"${COMMON.WIFI_PKEY}\" -D OTA_PASSWORD=\"OtaAuthPatrixDEV\" -D BOOT_DELAY=false -D DEBUG_LOG=false
|
||||
|
||||
[env:Fermenter]
|
||||
upload_port = 10.0.0.138
|
||||
upload_flags = --auth=OtaAuthPatrixFermenter
|
||||
upload_protocol = ${COMMON.ota_protocol}
|
||||
;upload_port = ${COMMON.usb_port}
|
||||
;upload_speed = ${COMMON.usb_speed}
|
||||
platform = ${COMMON.platform}
|
||||
board = ${COMMON.board}
|
||||
;upload_port = 10.0.0.138
|
||||
;upload_flags = --auth=OtaAuthPatrixFermenter
|
||||
;upload_protocol = ${COMMON.ota_protocol}
|
||||
upload_port = ${COMMON.usb_port}
|
||||
upload_speed = ${COMMON.usb_speed}
|
||||
platform = espressif8266
|
||||
board = esp12e
|
||||
framework = ${COMMON.framework}
|
||||
monitor_port = ${COMMON.monitor_port}
|
||||
monitor_speed = ${COMMON.monitor_speed}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user