mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-04 00:48:24 +02:00
Merge branch 'lumapu:main' into mqtt-max-char
This commit is contained in:
commit
3468748a93
9 changed files with 102 additions and 69 deletions
|
@ -4,10 +4,11 @@ on:
|
|||
push:
|
||||
branches: main
|
||||
paths:
|
||||
- 'tools/esp8266/**' # build only when changes occur here
|
||||
- '!tools/esp8266/README.md'
|
||||
- '!tools/esp8266/CHANGES.md'
|
||||
- '!tools/esp8266/User_Manual.md'
|
||||
- 'src/**' # build only when changes occur here
|
||||
- '.github/workflows/compile_release.yml'
|
||||
- '!README.md'
|
||||
- '!CHANGES.md'
|
||||
- '!User_Manual.md'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -48,8 +49,9 @@ jobs:
|
|||
- name: Convert HTML files
|
||||
working-directory: src/web/html
|
||||
run: python convert.py
|
||||
|
||||
- name: Run PlatformIO
|
||||
run: pio run -d tools/esp8266 --environment esp8266-release --environment esp8285-release --environment esp32-wroom32-release
|
||||
run: pio run -d src --environment esp8266-release --environment esp8285-release --environment esp32-wroom32-release
|
||||
|
||||
- name: Rename Binary files
|
||||
id: rename-binary-files
|
||||
|
@ -64,17 +66,19 @@ jobs:
|
|||
prerelease: false
|
||||
release_name: ${{ steps.rename-binary-files.outputs.name }}
|
||||
tag_name: ${{ steps.rename-binary-files.outputs.name }}
|
||||
body_path: tools/esp8266/CHANGES.md
|
||||
body_path: src/CHANGES.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
- name: set-version
|
||||
|
||||
- name: Set Version
|
||||
uses: cschleiden/replace-tokens@v1
|
||||
with:
|
||||
files: tools/esp8266/User_Manual.md
|
||||
files: User_Manual.md
|
||||
env:
|
||||
VERSION: ${{ steps.rename-binary-files.outputs.name }}
|
||||
- name: create-artifact
|
||||
run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip tools/esp8266/.pio/build/out/* tools/esp8266/User_Manual.md
|
||||
|
||||
- name: Create Artifact
|
||||
run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip src/firmware/* User_Manual.md
|
||||
|
||||
- name: Upload Release
|
||||
id: upload-release
|
|
@ -14,6 +14,7 @@ List of approaches
|
|||
|
||||
## Quick Start with ESP8266
|
||||
- [Go here ✨](Getting_Started.md#things-needed)
|
||||
- [Our Website](https://ahoydtu.de)
|
||||
|
||||
|
||||
## Success Stories
|
||||
|
|
13
src/CHANGES.md
Normal file
13
src/CHANGES.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Changelog
|
||||
|
||||
* fix browser sync NTP button
|
||||
* added login feature (protect web ui)
|
||||
* added static IP option
|
||||
* improved initial boot - don't connect to `YOUR_WIFI_SSID` any more, directly boot into AP mode
|
||||
* added status LED support
|
||||
* improved MQTT handling (boot, periodic updates, no zero values any more)
|
||||
* replaced deprecated workflow functions
|
||||
* refactored code to make it more clearly
|
||||
* added scheduler to register functions which need to be run each second / minute / ...
|
||||
* changed settings to littlefs (-> no currupt settings in future on memory layout changes)
|
||||
* added a lot of system infos to `System` page for support
|
|
@ -42,6 +42,8 @@ void app::setup(uint32_t timeout) {
|
|||
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, mSys, &mUtcTimestamp, &mSunrise, &mSunset);
|
||||
mPayload.addListener(std::bind(&PubMqttType::payloadEventListener, &mMqtt, std::placeholders::_1));
|
||||
addListener(EVERY_SEC, std::bind(&PubMqttType::tickerSecond, &mMqtt));
|
||||
addListener(EVERY_MIN, std::bind(&PubMqttType::tickerMinute, &mMqtt));
|
||||
addListener(EVERY_HR, std::bind(&PubMqttType::tickerHour, &mMqtt));
|
||||
}
|
||||
#endif
|
||||
setupLed();
|
||||
|
@ -225,7 +227,6 @@ void app::resetSystem(void) {
|
|||
mRxTicker = 0;
|
||||
|
||||
mSendLastIvId = 0;
|
||||
|
||||
mShowRebootRequest = false;
|
||||
|
||||
memset(&mStat, 0, sizeof(statistics_t));
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 5
|
||||
#define VERSION_PATCH 40
|
||||
#define VERSION_PATCH 41
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -67,6 +67,23 @@ class PubMqtt {
|
|||
sendIvData();
|
||||
}
|
||||
|
||||
void tickerMinute() {
|
||||
if(mAddressSet) {
|
||||
char val[40];
|
||||
snprintf(val, 40, "%ld", millis() / 1000);
|
||||
sendMsg("uptime", val);
|
||||
|
||||
sendMsg("wifi_rssi", String(WiFi.RSSI()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void tickerHour() {
|
||||
if(mAddressSet) {
|
||||
sendMsg("sunrise", String(*mSunrise).c_str());
|
||||
sendMsg("sunset", String(*mSunset).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void setCallback(MQTT_CALLBACK_SIGNATURE) {
|
||||
mClient->setCallback(callback);
|
||||
}
|
||||
|
@ -218,18 +235,10 @@ class PubMqtt {
|
|||
return;
|
||||
|
||||
isConnected(true); // really needed? See comment from HorstG-57 #176
|
||||
char topic[32 + MAX_NAME_LENGTH], val[32];
|
||||
char topic[32 + MAX_NAME_LENGTH], val[40];
|
||||
float total[4];
|
||||
bool sendTotal = false;
|
||||
bool totalIncomplete = false;
|
||||
snprintf(val, 40, "%ld", millis() / 1000);
|
||||
|
||||
sendMsg("uptime", val);
|
||||
|
||||
sendMsg("wifi_rssi", String(WiFi.RSSI()).c_str());
|
||||
|
||||
sendMsg("sunrise", String(*mSunrise).c_str());
|
||||
sendMsg("sunset", String(*mSunset).c_str());
|
||||
|
||||
while(!mSendList.empty()) {
|
||||
memset(total, 0, sizeof(float) * 4);
|
||||
|
|
|
@ -31,32 +31,6 @@ function parseESP(obj) {
|
|||
document.getElementById("esp_type").innerHTML="Board: " + obj["esp_type"];
|
||||
}
|
||||
|
||||
function parseSysInfo(obj) {
|
||||
const data = ["sdk_version", "cpu_freq", "chip_revision", "chip_model", "chip_cores", "esp_type"];
|
||||
|
||||
var ul = document.getElementById("info");
|
||||
|
||||
if(!isNaN(obj["heap_total"])) {
|
||||
document.getElementById("info").innerHTML = 'Heap:<progress id="heap" max="100" value="0"></progress> <span id="heap_used"></span> bytes (<span id="heap_total"></span> bytes)';
|
||||
changeProgressbar("heap", obj["heap_used"], obj["heap_total"]);
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if(!data.includes(key) || (typeof value == 'undefined')) continue;
|
||||
var li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode(key + ": " + value));
|
||||
ul.appendChild(li);
|
||||
}
|
||||
}
|
||||
|
||||
function changeProgressbar(id, value, max) {
|
||||
document.getElementById(id).value = value;
|
||||
document.getElementById(id).max = max;
|
||||
|
||||
document.getElementById("heap_used").textContent = value;
|
||||
document.getElementById("heap_total").textContent = max;
|
||||
}
|
||||
|
||||
function setHide(id, hide) {
|
||||
var elm = document.getElementById(id);
|
||||
if(hide) {
|
||||
|
@ -67,7 +41,6 @@ function setHide(id, hide) {
|
|||
elm.classList.remove('hide');
|
||||
}
|
||||
|
||||
|
||||
function toggle(id) {
|
||||
var e = document.getElementById(id);
|
||||
if(!e.classList.contains("hide"))
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
<div id="wrapper">
|
||||
<div id="content">
|
||||
<div id="info"></div>
|
||||
<div><ul id="info"></ul></div>
|
||||
<div id="system"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,6 +44,21 @@
|
|||
parseESP(obj);
|
||||
}
|
||||
|
||||
function parseSysInfo(obj) {
|
||||
const data = ["sdk", "cpu_freq", "chip_revision",
|
||||
"chip_model", "chip_cores", "esp_type", "mac", "wifi_rssi",
|
||||
"flash_size", "sketch_used", "heap_total", "heap_free", "heap_frag",
|
||||
"max_free_blk", "version", "core_version", "reboot_reason"];
|
||||
|
||||
var ul = document.getElementById("info");
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if(!data.includes(key) || (typeof value == 'undefined')) continue;
|
||||
var li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode(key + ": " + value));
|
||||
ul.appendChild(li);
|
||||
}
|
||||
}
|
||||
|
||||
function parse(obj) {
|
||||
if(null != obj) {
|
||||
parseMenu(obj["menu"]);
|
||||
|
|
|
@ -142,30 +142,47 @@ void webApi::onDwnldSetup(AsyncWebServerRequest *request) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void webApi::getSysInfo(JsonObject obj) {
|
||||
obj[F("ssid")] = mConfig->sys.stationSsid;
|
||||
obj[F("device_name")] = mConfig->sys.deviceName;
|
||||
obj[F("version")] = String(mVersion);
|
||||
obj[F("build")] = String(AUTO_GIT_HASH);
|
||||
obj[F("ts_uptime")] = mApp->getUptime();
|
||||
obj[F("ts_now")] = mApp->getTimestamp();
|
||||
obj[F("ts_sunrise")] = mApp->getSunrise();
|
||||
obj[F("ts_sunset")] = mApp->getSunset();
|
||||
obj[F("ts_sun_upd")] = mApp->getLatestSunTimestamp();
|
||||
obj[F("wifi_rssi")] = WiFi.RSSI();
|
||||
obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0);
|
||||
obj[F("ssid")] = mConfig->sys.stationSsid;
|
||||
obj[F("device_name")] = mConfig->sys.deviceName;
|
||||
obj[F("version")] = String(mVersion);
|
||||
obj[F("build")] = String(AUTO_GIT_HASH);
|
||||
obj[F("ts_uptime")] = mApp->getUptime();
|
||||
obj[F("ts_now")] = mApp->getTimestamp();
|
||||
obj[F("ts_sunrise")] = mApp->getSunrise();
|
||||
obj[F("ts_sunset")] = mApp->getSunset();
|
||||
obj[F("ts_sun_upd")] = mApp->getLatestSunTimestamp();
|
||||
obj[F("wifi_rssi")] = WiFi.RSSI();
|
||||
obj[F("mac")] = WiFi.macAddress();
|
||||
obj[F("hostname")] = WiFi.getHostname();
|
||||
obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0);
|
||||
|
||||
obj[F("sdk")] = ESP.getSdkVersion();
|
||||
obj[F("cpu_freq")] = ESP.getCpuFreqMHz();
|
||||
obj[F("heap_free")] = ESP.getFreeHeap();
|
||||
obj[F("sketch_total")] = ESP.getFreeSketchSpace();
|
||||
obj[F("sketch_used")] = ESP.getSketchSize() / 1024; // in kb
|
||||
|
||||
obj[F("hostname")] = WiFi.getHostname();
|
||||
obj[F("sdk_version")] = ESP.getSdkVersion();
|
||||
obj[F("cpu_freq")] = ESP.getCpuFreqMHz();
|
||||
#if defined(ESP32)
|
||||
obj[F("heap_total")] = ESP.getHeapSize();
|
||||
obj[F("heap_used")] = ESP.getHeapSize() - ESP.getFreeHeap();
|
||||
obj[F("chip_revision")] = ESP.getChipRevision();
|
||||
obj[F("chip_model")] = ESP.getChipModel();
|
||||
obj[F("chip_cores")] = ESP.getChipCores();
|
||||
obj[F("chip_revision")] = ESP.getChipRevision();
|
||||
obj[F("chip_model")] = ESP.getChipModel();
|
||||
obj[F("chip_cores")] = ESP.getChipCores();
|
||||
//obj[F("core_version")] = F("n/a");
|
||||
//obj[F("flash_size")] = F("n/a");
|
||||
//obj[F("heap_frag")] = F("n/a");
|
||||
//obj[F("max_free_blk")] = F("n/a");
|
||||
//obj[F("reboot_reason")] = F("n/a");
|
||||
#else
|
||||
//obj[F("heap_total")] = F("n/a");
|
||||
//obj[F("chip_revision")] = F("n/a");
|
||||
//obj[F("chip_model")] = F("n/a");
|
||||
//obj[F("chip_cores")] = F("n/a");
|
||||
obj[F("core_version")] = ESP.getCoreVersion();
|
||||
obj[F("flash_size")] = ESP.getFlashChipRealSize() / 1024; // in kb
|
||||
obj[F("heap_frag")] = ESP.getHeapFragmentation();
|
||||
obj[F("max_free_blk")] = ESP.getMaxFreeBlockSize();
|
||||
obj[F("reboot_reason")] = ESP.getResetReason();
|
||||
#endif
|
||||
obj[F("sketch_total")] = ESP.getFreeSketchSpace();
|
||||
obj[F("sketch_used")] = ESP.getSketchSize();
|
||||
//obj[F("littlefs_total")] = LittleFS.totalBytes();
|
||||
//obj[F("littlefs_used")] = LittleFS.usedBytes();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue