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
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
- 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
|
||||
run: |
|
||||
cp .pio/build/esp32/firmware.bin esp32.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-plus/firmware.bin m5stickc-plus.bin
|
||||
cp .pio/build/m5atom-matrix/firmware.bin m5atom-matrix.bin
|
||||
cp .pio/build/macchina-a0/firmware.bin macchina-a0.bin
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
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/),
|
||||
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]
|
||||
|
||||
- Web portal works after wifi connection details established (#13)
|
||||
|
|
|
@ -31,19 +31,6 @@ monitor_speed = 115200
|
|||
monitor_filters = esp32_exception_decoder
|
||||
build_flags =
|
||||
-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]
|
||||
platform = espressif32
|
||||
|
@ -58,7 +45,6 @@ build_flags =
|
|||
-D CORE_DEBUG_LEVEL=2
|
||||
-D FIRMWARE='"esp32-verbose"'
|
||||
-D VERBOSE
|
||||
-Wall
|
||||
|
||||
[env:m5stickc]
|
||||
platform = espressif32
|
||||
|
@ -73,7 +59,6 @@ monitor_filters = esp32_exception_decoder
|
|||
build_flags =
|
||||
-D M5STICK
|
||||
-D FIRMWARE='"m5stickc"'
|
||||
-Wall
|
||||
|
||||
[env:m5stickc-plus]
|
||||
platform = espressif32
|
||||
|
@ -89,7 +74,6 @@ build_flags =
|
|||
-D M5STICK
|
||||
-D PLUS
|
||||
-D FIRMWARE='"m5stickc-plus"'
|
||||
-Wall
|
||||
|
||||
[env:m5atom-matrix]
|
||||
platform = espressif32
|
||||
|
@ -106,4 +90,14 @@ build_flags =
|
|||
-D M5ATOM
|
||||
-D 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
|
||||
#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["firm"] = String(FIRMWARE);
|
||||
tele["rssi"] = WiFi.RSSI();
|
||||
|
||||
#ifdef MACCHINA_A0
|
||||
tele["batt"] = a0_read_batt_mv() / 1000.0f;
|
||||
#endif
|
||||
#ifdef VERSION
|
||||
tele["ver"] = String(VERSION);
|
||||
#endif
|
||||
|
@ -102,6 +104,7 @@ void connectToWifi()
|
|||
|
||||
WiFiSettings.heading("Preferences");
|
||||
|
||||
autoUpdate = WiFiSettings.checkbox("auto_update", DEFAULT_AUTO_UPDATE, "Automatically Update");
|
||||
discovery = WiFiSettings.checkbox("discovery", true, "Home Assistant Discovery");
|
||||
activeScan = WiFiSettings.checkbox("active_scan", true, "Active scanning (uses more battery but more results)");
|
||||
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 roomsTopic;
|
||||
String subTopic;
|
||||
bool autoUpdate;
|
||||
bool discovery;
|
||||
bool activeScan;
|
||||
bool publishTele;
|
||||
bool publishRooms;
|
||||
bool publishDevices;
|
||||
bool discovery;
|
||||
int maxDistance;
|
||||
int pirPin;
|
||||
int radarPin;
|
||||
|
@ -159,8 +160,7 @@ void configureOTA()
|
|||
|
||||
void firmwareUpdate()
|
||||
{
|
||||
#ifndef NOUPDATE
|
||||
#ifdef VERSION
|
||||
if (!autoUpdate) return;
|
||||
static long lastFirmwareCheck = 0;
|
||||
long uptime = getUptimeSeconds();
|
||||
if (uptime - lastFirmwareCheck < CHECK_FOR_UPDATES_INTERVAL)
|
||||
|
@ -176,6 +176,7 @@ void firmwareUpdate()
|
|||
if (!http.begin(client, firmwareUrl))
|
||||
return;
|
||||
|
||||
#ifdef VERSION
|
||||
int httpCode = http.sendRequest("HEAD");
|
||||
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());
|
||||
}
|
||||
#endif
|
||||
|
||||
updateInProgress = true;
|
||||
fingerprints.setDisable(updateInProgress);
|
||||
|
@ -212,8 +214,6 @@ void firmwareUpdate()
|
|||
}
|
||||
|
||||
updateInProgress = false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void spiffsInit()
|
||||
|
@ -362,3 +362,11 @@ bool spurt(const String &fn, const String &content)
|
|||
f.close();
|
||||
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