Auto Updatie made a setting
This commit is contained in:
parent
4f04d7c94a
commit
dc4e5e3781
|
@ -30,15 +30,15 @@ jobs:
|
||||||
run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV
|
run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
- name: Run PlatformIO
|
- name: Run PlatformIO
|
||||||
run: pio run -e esp32 -e esp32-noupdate -e esp32-verbose -e m5stickc -e m5stickc-plus -e m5atom-matrix
|
run: pio run -e esp32 -e esp32-verbose -e m5stickc -e m5stickc-plus -e m5atom-matrix -e macchina-a0
|
||||||
- name: Rename firmware
|
- name: Rename firmware
|
||||||
run: |
|
run: |
|
||||||
cp .pio/build/esp32/firmware.bin esp32.bin
|
cp .pio/build/esp32/firmware.bin esp32.bin
|
||||||
cp .pio/build/esp32-verbose/firmware.bin esp32-verbose.bin
|
cp .pio/build/esp32-verbose/firmware.bin esp32-verbose.bin
|
||||||
cp .pio/build/esp32-noupdate/firmware.bin esp32-noupdate.bin
|
|
||||||
cp .pio/build/m5stickc/firmware.bin m5stickc.bin
|
cp .pio/build/m5stickc/firmware.bin m5stickc.bin
|
||||||
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin
|
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin
|
||||||
cp .pio/build/m5atom-matrix/firmware.bin m5atom-matrix.bin
|
cp .pio/build/m5atom-matrix/firmware.bin m5atom-matrix.bin
|
||||||
|
cp .pio/build/macchina-a0/firmware.bin macchina-a0.bin
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|
|
@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.6.1]
|
||||||
|
|
||||||
|
- Replaced NOUPDATE flavor with an autoupdate preference (#50)
|
||||||
|
- Add Macchina A0 flavor with battery mv reading (#51)
|
||||||
|
|
||||||
## [1.6.0]
|
## [1.6.0]
|
||||||
|
|
||||||
- Web portal works after wifi connection details established (#13)
|
- Web portal works after wifi connection details established (#13)
|
||||||
|
|
|
@ -31,19 +31,6 @@ monitor_speed = 115200
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
build_flags =
|
build_flags =
|
||||||
-D FIRMWARE='"esp32"'
|
-D FIRMWARE='"esp32"'
|
||||||
-Wall
|
|
||||||
|
|
||||||
[env:esp32-noupdate]
|
|
||||||
platform = espressif32
|
|
||||||
framework = arduino
|
|
||||||
board = esp32dev
|
|
||||||
lib_deps = ${common_env_data.lib_deps_external}
|
|
||||||
board_build.partitions = partitions_singleapp.csv
|
|
||||||
monitor_speed = 115200
|
|
||||||
build_flags =
|
|
||||||
-D FIRMWARE='"esp32-noupdate"'
|
|
||||||
-D NOUPDATE
|
|
||||||
-Wall
|
|
||||||
|
|
||||||
[env:esp32-verbose]
|
[env:esp32-verbose]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
|
@ -58,7 +45,6 @@ build_flags =
|
||||||
-D CORE_DEBUG_LEVEL=2
|
-D CORE_DEBUG_LEVEL=2
|
||||||
-D FIRMWARE='"esp32-verbose"'
|
-D FIRMWARE='"esp32-verbose"'
|
||||||
-D VERBOSE
|
-D VERBOSE
|
||||||
-Wall
|
|
||||||
|
|
||||||
[env:m5stickc]
|
[env:m5stickc]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
|
@ -73,7 +59,6 @@ monitor_filters = esp32_exception_decoder
|
||||||
build_flags =
|
build_flags =
|
||||||
-D M5STICK
|
-D M5STICK
|
||||||
-D FIRMWARE='"m5stickc"'
|
-D FIRMWARE='"m5stickc"'
|
||||||
-Wall
|
|
||||||
|
|
||||||
[env:m5stickc-plus]
|
[env:m5stickc-plus]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
|
@ -89,7 +74,6 @@ build_flags =
|
||||||
-D M5STICK
|
-D M5STICK
|
||||||
-D PLUS
|
-D PLUS
|
||||||
-D FIRMWARE='"m5stickc-plus"'
|
-D FIRMWARE='"m5stickc-plus"'
|
||||||
-Wall
|
|
||||||
|
|
||||||
[env:m5atom-matrix]
|
[env:m5atom-matrix]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
|
@ -106,4 +90,14 @@ build_flags =
|
||||||
-D M5ATOM
|
-D M5ATOM
|
||||||
-D MATRIX
|
-D MATRIX
|
||||||
-D FIRMWARE='"m5atom-matrix"'
|
-D FIRMWARE='"m5atom-matrix"'
|
||||||
-Wall
|
|
||||||
|
[env:macchina-a0]
|
||||||
|
platform = espressif32
|
||||||
|
framework = arduino
|
||||||
|
board = esp32dev
|
||||||
|
lib_deps = ${common_env_data.lib_deps_external}
|
||||||
|
board_build.partitions = partitions_singleapp.csv
|
||||||
|
monitor_speed = 115200
|
||||||
|
build_flags =
|
||||||
|
-D MACCHINA_A0
|
||||||
|
-D FIRMWARE='"macchina-a0"'
|
||||||
|
|
|
@ -40,3 +40,9 @@
|
||||||
|
|
||||||
// Number of seconds between update checks
|
// Number of seconds between update checks
|
||||||
#define CHECK_FOR_UPDATES_INTERVAL 300
|
#define CHECK_FOR_UPDATES_INTERVAL 300
|
||||||
|
|
||||||
|
#ifdef VERSION
|
||||||
|
#define DEFAULT_AUTO_UPDATE true
|
||||||
|
#else
|
||||||
|
#define DEFAULT_AUTO_UPDATE false
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,7 +27,9 @@ bool sendTelemetry(int totalSeen = -1, int totalReported = -1, int totalAdverts
|
||||||
tele["uptime"] = getUptimeSeconds();
|
tele["uptime"] = getUptimeSeconds();
|
||||||
tele["firm"] = String(FIRMWARE);
|
tele["firm"] = String(FIRMWARE);
|
||||||
tele["rssi"] = WiFi.RSSI();
|
tele["rssi"] = WiFi.RSSI();
|
||||||
|
#ifdef MACCHINA_A0
|
||||||
|
tele["batt"] = a0_read_batt_mv() / 1000.0f;
|
||||||
|
#endif
|
||||||
#ifdef VERSION
|
#ifdef VERSION
|
||||||
tele["ver"] = String(VERSION);
|
tele["ver"] = String(VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
@ -102,6 +104,7 @@ void connectToWifi()
|
||||||
|
|
||||||
WiFiSettings.heading("Preferences");
|
WiFiSettings.heading("Preferences");
|
||||||
|
|
||||||
|
autoUpdate = WiFiSettings.checkbox("auto_update", DEFAULT_AUTO_UPDATE, "Automatically Update");
|
||||||
discovery = WiFiSettings.checkbox("discovery", true, "Home Assistant Discovery");
|
discovery = WiFiSettings.checkbox("discovery", true, "Home Assistant Discovery");
|
||||||
activeScan = WiFiSettings.checkbox("active_scan", true, "Active scanning (uses more battery but more results)");
|
activeScan = WiFiSettings.checkbox("active_scan", true, "Active scanning (uses more battery but more results)");
|
||||||
publishTele = WiFiSettings.checkbox("pub_tele", true, "Send to telemetry topic");
|
publishTele = WiFiSettings.checkbox("pub_tele", true, "Send to telemetry topic");
|
||||||
|
|
18
src/main.h
18
src/main.h
|
@ -40,11 +40,12 @@ String statusTopic;
|
||||||
String teleTopic;
|
String teleTopic;
|
||||||
String roomsTopic;
|
String roomsTopic;
|
||||||
String subTopic;
|
String subTopic;
|
||||||
|
bool autoUpdate;
|
||||||
|
bool discovery;
|
||||||
bool activeScan;
|
bool activeScan;
|
||||||
bool publishTele;
|
bool publishTele;
|
||||||
bool publishRooms;
|
bool publishRooms;
|
||||||
bool publishDevices;
|
bool publishDevices;
|
||||||
bool discovery;
|
|
||||||
int maxDistance;
|
int maxDistance;
|
||||||
int pirPin;
|
int pirPin;
|
||||||
int radarPin;
|
int radarPin;
|
||||||
|
@ -159,8 +160,7 @@ void configureOTA()
|
||||||
|
|
||||||
void firmwareUpdate()
|
void firmwareUpdate()
|
||||||
{
|
{
|
||||||
#ifndef NOUPDATE
|
if (!autoUpdate) return;
|
||||||
#ifdef VERSION
|
|
||||||
static long lastFirmwareCheck = 0;
|
static long lastFirmwareCheck = 0;
|
||||||
long uptime = getUptimeSeconds();
|
long uptime = getUptimeSeconds();
|
||||||
if (uptime - lastFirmwareCheck < CHECK_FOR_UPDATES_INTERVAL)
|
if (uptime - lastFirmwareCheck < CHECK_FOR_UPDATES_INTERVAL)
|
||||||
|
@ -176,6 +176,7 @@ void firmwareUpdate()
|
||||||
if (!http.begin(client, firmwareUrl))
|
if (!http.begin(client, firmwareUrl))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef VERSION
|
||||||
int httpCode = http.sendRequest("HEAD");
|
int httpCode = http.sendRequest("HEAD");
|
||||||
if (httpCode < 300 || httpCode > 400 || http.getLocation().indexOf(String(VERSION)) > 0)
|
if (httpCode < 300 || httpCode > 400 || http.getLocation().indexOf(String(VERSION)) > 0)
|
||||||
{
|
{
|
||||||
|
@ -187,6 +188,7 @@ void firmwareUpdate()
|
||||||
{
|
{
|
||||||
Serial.printf("Updating from (sc=%d): %s\n", httpCode, http.getLocation().c_str());
|
Serial.printf("Updating from (sc=%d): %s\n", httpCode, http.getLocation().c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
updateInProgress = true;
|
updateInProgress = true;
|
||||||
fingerprints.setDisable(updateInProgress);
|
fingerprints.setDisable(updateInProgress);
|
||||||
|
@ -212,8 +214,6 @@ void firmwareUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
updateInProgress = false;
|
updateInProgress = false;
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiffsInit()
|
void spiffsInit()
|
||||||
|
@ -362,3 +362,11 @@ bool spurt(const String &fn, const String &content)
|
||||||
f.close();
|
f.close();
|
||||||
return w == content.length();
|
return w == content.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MACCHINA_A0
|
||||||
|
int a0_read_batt_mv()
|
||||||
|
{
|
||||||
|
float vout = ((float)analogRead(GPIO_NUM_35) + 35) / 215.0;
|
||||||
|
return vout * 1100; // V to mV with +10% correction
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue