Skip to content

Commit

Permalink
0.7.35
Browse files Browse the repository at this point in the history
* fixed timestamp for alarms send over MqTT
* auto-patch of `AsyncWebServer` #834, #1036
* Update documentation in Git regarding `ESP8266` default NRF24 pin assignments
  • Loading branch information
lumapu committed Aug 17, 2023
1 parent ac53925 commit ed268d1
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Getting_Started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Overview
## Overview

On this page, you'll find detailed instructions on how to wire the module of a Wemos D1 mini or ESP32 to the radio module, as well as how to flash it with the latest firmware. This information will enable you to communicate with compatible inverters.

Expand Down Expand Up @@ -122,11 +122,11 @@ This is an example wiring using a Wemos D1 mini.<br>

##### Schematic

![Schematic](doc/AhoyWemos_Schaltplan.jpg)
![Schematic](https://ahoydtu.de/img/fritzing/esp8266_nrf_sch.png)

##### Symbolic view

![Symbolic](doc/AhoyWemos_Steckplatine.jpg)
![Symbolic](https://ahoydtu.de/img/fritzing/esp8266_nrf.png)

#### ESP8266 wiring example on 30pin Lolin NodeMCU v3

Expand All @@ -146,11 +146,11 @@ Example wiring for a 38pin ESP32 module

##### Schematic

![Schematic](doc/Wiring_ESP32_Schematic.png)
![Schematic](https://ahoydtu.de/img/fritzing/esp32-38_nrf_sch.png)

##### Symbolic view

![Symbolic](doc/Wiring_ESP32_Symbol.png)
![Symbolic](https://ahoydtu.de/img/fritzing/esp32-38_nrf.png)

##### ESP32 GPIO settings

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa] [![Ahoy Dev Build][dev-action-badge]][dev-action-link]
[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa]
[![Ahoy Build][release-action-badge]][release-action-link] [![Ahoy Dev Build][dev-action-badge]][dev-action-link]

This work is licensed under a
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].
Expand All @@ -9,6 +10,9 @@ This work is licensed under a
[cc-by-nc-sa-image]: https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png
[cc-by-nc-sa-shield]: https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg

[release-action-badge]: https://github.com/lumapu/ahoy/actions/workflows/compile_release.yml/badge.svg
[release-action-link]: https://github.com/lumapu/ahoy/actions/workflows/compile_release.yml

[dev-action-badge]: https://github.com/lumapu/ahoy/actions/workflows/compile_development.yml/badge.svg
[dev-action-link]: https://github.com/lumapu/ahoy/actions/workflows/compile_development.yml

Expand Down
13 changes: 13 additions & 0 deletions patches/AsyncWeb_Prometheus.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp
index 22a549f..e0b36b3 100644
--- a/src/WebResponses.cpp
+++ b/src/WebResponses.cpp
@@ -318,7 +318,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
free(buf);
return 0;
}
- outLen = sprintf_P((char*)buf+headLen, PSTR("%x"), readLen) + headLen;
+ outLen = sprintf_P((char*)buf+headLen, PSTR("%04x"), readLen) + headLen;
while(outLen < headLen + 4) buf[outLen++] = ' ';
buf[outLen++] = '\r';
buf[outLen++] = '\n';
20 changes: 20 additions & 0 deletions scripts/applyPatches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
import subprocess
Import("env")

def applyPatch(libName, patchFile):
os.chdir('.pio/libdeps/' + env['PIOENV'] + '/' + libName)

process = subprocess.run(['git', 'apply', '--reverse', '--check', '../../../../' + patchFile], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if (process.returncode == 0):
print('\'' + patchFile + '\' already applied')
else:
process = subprocess.run(['git', 'apply', '../../../../' + patchFile])
if (process.returncode == 0):
print('\'' + patchFile + '\' applied')
else:
print('applying \'' + patchFile + '\' failed')


# list of patches to apply (relative to /src)
applyPatch("ESP Async WebServer", "../patches/AsyncWeb_Prometheus.patch")
5 changes: 5 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Development Changes

## 0.7.35 - 2023-08-17
* fixed timestamp for alarms send over MqTT
* auto-patch of `AsyncWebServer` #834, #1036
* Update documentation in Git regarding `ESP8266` default NRF24 pin assignments

## 0.7.34 - 2023-08-16
* fixed timezone offset of alarms
* added `AC` and `DC` to `/live` #1098
Expand Down
3 changes: 2 additions & 1 deletion src/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ monitor_speed = 115200
extra_scripts =
pre:../scripts/auto_firmware_version.py
pre:web/html/convert.py
pre:../scripts/applyPatches.py

lib_deps =
https://github.com/yubox-node-org/ESPAsyncWebServer
Expand Down Expand Up @@ -183,4 +184,4 @@ build_flags =
-std=gnu++17
build_unflags = -std=gnu++11
monitor_filters =
time ; Add timestamp with milliseconds for each new line
time ; Add timestamp with milliseconds for each new line
6 changes: 4 additions & 2 deletions src/publisher/pubMqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ class PubMqtt {

void sendAlarmData() {
Inverter<> *iv;
uint32_t localTime = gTimezone.toLocal(*mUtcTimestamp);
uint32_t lastMidnight = gTimezone.toUTC(localTime - (localTime % 86400)); // last midnight local time
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
if(!mSendAlarm[i])
continue;
Expand Down Expand Up @@ -527,11 +529,11 @@ class PubMqtt {
publish(mSubTopic, mVal, true);

snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/alarm/%d/start", iv->config->name, j);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].start);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].start + lastMidnight);
publish(mSubTopic, mVal, true);

snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/alarm/%d/end", iv->config->name, j);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].end);
snprintf(mVal, 40, "%d", iv->lastAlarm[j].end + lastMidnight);
publish(mSubTopic, mVal, true);
yield();
}
Expand Down

0 comments on commit ed268d1

Please sign in to comment.