Merge pull request #550 from srg74/master

ESP-07 module support
This commit is contained in:
Aircoookie 2020-01-06 01:30:05 +01:00 committed by GitHub
commit d32d4e21e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 4 deletions

View File

@ -32,4 +32,4 @@ install:
- pip install -U platformio - pip install -U platformio
- platformio update - platformio update
script: script:
- platformio ci --project-conf=./platformio.ini -v - platformio ci --project-conf=./platformio.ini

View File

@ -10,6 +10,7 @@ lib_dir = ./wled00/src
; env_default = nodemcuv2 ; env_default = nodemcuv2
; env_default = esp01 ; env_default = esp01
; env_default = esp01_1m ; env_default = esp01_1m
; env_default = esp07
; env_default = d1_mini ; env_default = d1_mini
; env_default = esp32dev ; env_default = esp32dev
; env_default = esp8285_4CH_MagicHome ; env_default = esp8285_4CH_MagicHome
@ -43,7 +44,9 @@ lib_deps_external =
#Timezone@1.2.1 #Timezone@1.2.1
#For use SSD1306 0.91" OLED display uncomment following #For use SSD1306 0.91" OLED display uncomment following
#U8g2@~2.27.2 #U8g2@~2.27.2
#For Dallas sensor uncomment following 2 lines
#DallasTemperature@~3.8.0
#OneWire@~2.3.5
[common:esp8266] [common:esp8266]
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# PLATFORM: # PLATFORM:
@ -156,6 +159,18 @@ build_flags =
lib_deps = lib_deps =
${common.lib_deps_external} ${common.lib_deps_external}
[env:esp07]
board = esp07
platform = ${common:esp8266.platform}
monitor_speed = ${common.monitor_speed}
upload_speed = ${common.upload_speed}
framework = ${common.framework}
build_flags =
${common.build_flags}
${common:esp8266.build_flags}
lib_deps =
${common.lib_deps_external}
# see: http://docs.platformio.org/en/latest/platforms/espressif32.html # see: http://docs.platformio.org/en/latest/platforms/espressif32.html
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev

View File

@ -39,6 +39,8 @@ uint8_t knownMode = 0;
uint8_t knownPalette = 0; uint8_t knownPalette = 0;
long lastUpdate = 0; long lastUpdate = 0;
long lastRedraw = 0;
bool displayTurnedOff = false;
// How often we are redrawing screen // How often we are redrawing screen
#define USER_LOOP_REFRESH_RATE_MS 5000 #define USER_LOOP_REFRESH_RATE_MS 5000
@ -49,9 +51,15 @@ void userLoop() {
return; return;
} }
lastUpdate = millis(); lastUpdate = millis();
// Turn off display after 3 minutes with no change.
if(!displayTurnedOff && millis() - lastRedraw > 3*60*1000) {
u8x8.setPowerSave(1);
displayTurnedOff = true;
}
// Check if values which are shown on display changed from the last tiem. // Check if values which are shown on display changed from the last time.
if ((apActive == true ? String(apSSID) : WiFi.SSID()) != knownSsid) { if (((apActive) ? String(apSSID) : WiFi.SSID()) != knownSsid) {
needRedraw = true; needRedraw = true;
} else if (knownIp != (apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP())) { } else if (knownIp != (apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP())) {
needRedraw = true; needRedraw = true;
@ -67,6 +75,13 @@ void userLoop() {
return; return;
} }
needRedraw = false; needRedraw = false;
if (displayTurnedOff)
{
u8x8.setPowerSave(0);
displayTurnedOff = false;
}
lastRedraw = millis();
// Update last known values. // Update last known values.
#if defined(ESP8266) #if defined(ESP8266)