Browse Source

Merge branch 'lumapu:development03' into development03

pull/846/head
rejoe2 2 years ago
committed by GitHub
parent
commit
61fa452800
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 42
      .github/ISSUE_TEMPLATE/report-ahoy.md
  2. 132
      .github/ISSUE_TEMPLATE/report.yaml
  3. 6
      src/CHANGES.md
  4. 2
      src/defines.h
  5. 6
      src/web/html/includes/header.html
  6. 14
      src/web/html/includes/nav.html
  7. 85
      src/web/web.h
  8. 6
      src/wifi/ahoywifi.cpp

42
.github/ISSUE_TEMPLATE/report-ahoy.md

@ -22,58 +22,22 @@ Retailer URL: ______
### Antenna: ### Antenna:
* [ ] circuit board * [ ] circuit board
* [ ] external antenna * [ ] external antenna (SMA)
### Power Stabilization: ### Power Stabilization:
* [ ] 100uF Electrolytic Capacitor * [ ] 100uF Electrolytic Capacitor
connected between +3.3V and GND (Pin 1 & 2) of the NRF Module connected between +3.3V and GND (Pin 1 & 2) of the NRF Module
* [ ] Voltage stabilizing motherboard * [ ] Voltage stabilizing motherboard
### Connection diagram:
* [ ] Image of the your wiring attached
### Connection diagram I used:
| nRF24L01+ Pin | ESP8266 GPIO |
| ------------- | -------------- |
| Pin 1 GND [*] | GND |
| Pin 2 +3.3V | +3.3V |
| Pin 3 CE | GPIO2 CE D4 |
| Pin 4 CSN | GPIO15 CS D8 |
| Pin 5 SCK | GPIO14 SCLK D5 |
| Pin 6 MOSI | GPIO13 MOSI D7 |
| Pin 7 MISO | GPIO12 MISO D6 |
| Pin 8 IRQ | GPIO0 IRQ D3 |
| nRF24L01+ Pin | ESP32 GPIO |
| ------------- | --------------- |
| Pin 1 GND [*] | GND |
| Pin 2 +3.3V | +3.3V |
| Pin 3 CE | GPIO4 CE D4 |
| Pin 4 CSN | GPIO5 CS D5 |
| Pin 5 SCK | GPIO18 SCLK D18 |
| Pin 6 MOSI | GPIO23 MOSI D23 |
| Pin 7 MISO | GPIO19 MISO D19 |
| Pin 8 IRQ | GPIO0 IRQ D0 |
Note: [*] GND Pin 1 has a square mark on the nRF24L01+ module
## Software
* [ ] AhoyDTU
* [ ] OpenDTU
### Version / Git SHA: ### Version / Git SHA:
Version: _._.__ Version: _._.__
Github Hash: _______ Github Hash: _______
### Build & Flash Method: ### Build & Flash Method:
* [ ] AhoyDTU Webinstaller
* [ ] VSCode - Platform IO
* [ ] Arduino * [ ] Arduino
* [ ] ESP Tools * [ ] ESP Tools
* [ ] Platform IO
### Desktop OS:
* [ ] Linux
* [ ] Windows
* [ ] Mac OS
### Debugging: ### Debugging:
* [ ] USB Serial Log (attached) * [ ] USB Serial Log (attached)

132
.github/ISSUE_TEMPLATE/report.yaml

@ -1,18 +1,20 @@
name: "AhoyDTU bug" name: "AhoyDTU bug"
description: "File a bug report" description: "File a bug report"
title: "[ESP8266/ESP32/RaspberryPi] Problem Description / Beschreibung" title: "[Bug]"
labels: ["bug", "needs-triage"] labels: ["bug", "needs-triage"]
assignees: assignees:
- stefan123t - lumapu
body: body:
- type: markdown - type: markdown
attributes: attributes:
value: | value: |
Bitte die Posting Guide lines lesen, Vorlage kopieren und ausfüllen und in Eurem Support Forum Eintrag posten. Bitte die Posting Guide lines lesen, Vorlage kopieren und ausfüllen und in Eurem Support Forum Eintrag posten.
Wir lesen auch gerne Deutsch, bitte fülle die u.a. Fragen aus damit wir Dir bestmöglich helfen können Danke! Wir lesen auch gerne Deutsch, bitte fülle die u.a. Fragen aus damit wir Dir bestmöglich helfen können Danke!
Bitte unser FAQ als Hilfestellung prüfen: https://ahoydtu.de/faq
Please read, copy & fill in the template from our Posting Guide lines into your Support Forum post. Please read, copy & fill in the template from our Posting Guide lines into your Support Forum post.
We do enjoy the english language, but we need a couple of things to best support you in your goal, please fill in all / most of the details given below. Thanks! We do enjoy the english language, but we need a couple of things to best support you in your goal, please fill in all / most of the details given below. Thanks!
Check our FAQ: https://ahoydtu.de/faq
- type: markdown - type: markdown
attributes: attributes:
value: "## Hardware" value: "## Hardware"
@ -35,11 +37,21 @@ body:
placeholder: placeholder:
validations: validations:
required: false required: false
- type: dropdown
id: assembly-type
attributes:
label: Assembly
description:
options:
- I did the assebly by myself
- the DTU was already assembled
validations:
required: true
- type: dropdown - type: dropdown
id: nrf24l01-module id: nrf24l01-module
attributes: attributes:
label: nRF24L01+ Module label: nRF24L01+ Module
description: | description: |
What type of nRF24L01+ chip is on your nRF24L01+ module ? What type of nRF24L01+ chip is on your nRF24L01+ module ?
* you verified this is a **nRF24L01+ plus** model capable of the required 256kBit/s mode ? * you verified this is a **nRF24L01+ plus** model capable of the required 256kBit/s mode ?
* **square dot** indicates original Nordic Semicon chip ? * **square dot** indicates original Nordic Semicon chip ?
@ -69,43 +81,11 @@ body:
* special **voltage stabilizing board** * special **voltage stabilizing board**
* **nothing** (yet) * **nothing** (yet)
options: options:
- ~100uF Elko - Elko (~100uF)
- board - board
- nothing - nothing
validations: validations:
required: true required: true
- type: textarea
id: connection-diagram
attributes:
label: Connection diagram
description: Tell us which connection diagram you used?
value: |
## Connection diagram I used:
| nRF24L01+ Pin | ESP8266 GPIO |
| ------------- | -------------- |
| Pin 1 GND [*] | GND |
| Pin 2 +3.3V | +3.3V |
| Pin 3 CE | GPIO2 CE D4 |
| Pin 4 CSN | GPIO15 CS D8 |
| Pin 5 SCK | GPIO14 SCLK D5 |
| Pin 6 MOSI | GPIO13 MOSI D7 |
| Pin 7 MISO | GPIO12 MISO D6 |
| Pin 8 IRQ | GPIO0 IRQ D3 |
| nRF24L01+ Pin | ESP32 GPIO |
| ------------- | --------------- |
| Pin 1 GND [*] | GND |
| Pin 2 +3.3V | +3.3V |
| Pin 3 CE | GPIO4 CE D4 |
| Pin 4 CSN | GPIO5 CS D5 |
| Pin 5 SCK | GPIO18 SCLK D18 |
| Pin 6 MOSI | GPIO23 MOSI D23 |
| Pin 7 MISO | GPIO19 MISO D19 |
| Pin 8 IRQ | GPIO0 IRQ D0 |
Note: [*] GND Pin 1 has a square mark on the nRF24L01+ module
validations:
required: true
- type: checkboxes - type: checkboxes
id: connection-picture id: connection-picture
attributes: attributes:
@ -123,7 +103,7 @@ body:
attributes: attributes:
label: Version label: Version
description: What version of our software are you running ? description: What version of our software are you running ?
placeholder: 0.5.17 placeholder: 0.6.0
validations: validations:
required: true required: true
- type: input - type: input
@ -131,7 +111,7 @@ body:
attributes: attributes:
label: Github Hash label: Github Hash
description: Which GitHub hash has the build of our software ? description: Which GitHub hash has the build of our software ?
placeholder: 5402e9b placeholder: 0000000
validations: validations:
required: true required: true
- type: dropdown - type: dropdown
@ -140,19 +120,11 @@ body:
label: Build & Flash Method label: Build & Flash Method
description: What software do you use to flash / build & flash our firmware images ? description: What software do you use to flash / build & flash our firmware images ?
options: options:
- AhoyDTU Webinstaller
- VSCode - Platform IO (build & flash)
- ESP Tools (flash) - ESP Tools (flash)
- Platform IO (build & flash) - Arduino IDE
validations: - was already installed
required: true
- type: dropdown
id: desktop-os
attributes:
label: Desktop
description: Which operating system are you using on your desktop to build & flash ?
options:
- Linux
- Mac OS
- Windows
validations: validations:
required: true required: true
- type: textarea - type: textarea
@ -160,49 +132,12 @@ body:
attributes: attributes:
label: Setup label: Setup
description: | description: |
Which settings are configured under http://ahoy-dtu/setup ? Which settings were modified to which values? Check this page on your DTU: http://ahoy-dtu/setup
Document any relevant setup values correctly. Do not post private data here (SSID / passwords / serial numbers)!
Copy and paste the Inverter Section if you have multiple Inverters. placeholder: |
value: | Some examples:
### Device Host Name - MqTT: only broker was added
- Device Name: AHOY-DTU - Inverter: set intervall to 5 seconds ..
### WiFi
- SSID: YOUR_WIFI_SSID *don't paste here*
- Password: YOUR_WIFI_PWD *don't paste here*
### Inverter
#### Inverter 0
- Address: 1141752123456
- Name: HM-600
- Active Power Limit: 65535
- Active Power Limit Control Type: no powerlimit
- Max Module Power (Wp): 375, 375
- Module Name: link, rech
### General
- Interval [s]: 30
- Max retries per Payload: 5
### NTP Server
- NTP Server / IP: pool.ntp.org
- NTP Port: 123
### MQTT
- Broker / Server IP:
- Port: 1883
- Username (optional):
- Password (optional):
- Topic: inverter
### System Config
#### Pinout (Wemos)
- CS: D8 (GPIO15)
- CE: D4 (GPIO2)
- IRQ: D3 (GPIO0)
#### Radio (NRF24L01+)
- Amplifier Power Level: LOW
#### Serial Console
- print inverter data: [x]
- Serial Debug: [x]
- Interval [s]: 5
- Reboot device after successful save: [x]
- SAVE
validations: validations:
required: true required: true
- type: textarea - type: textarea
@ -219,12 +154,9 @@ body:
attributes: attributes:
label: Error description label: Error description
description: Please describe what you expected and what happened instead. description: Please describe what you expected and what happened instead.
value: | placeholder: |
1) Go to http://ahoy-dtu/setup 1) I went to https://ahoy-dtu.de/web_install and installed latest release
2) configure above settings 2) I did some configurations, especially ...
3) Reboot ...
4) I did this
5) I expected that
6) and something completely differen happened
validations: validations:
required: true required: true

6
src/CHANGES.md

@ -1,5 +1,11 @@
# Development Changes # Development Changes
## 0.6.3 - 2023-04-04
* fix login, password length was not checked #852
* merge PR #854 optimize browser caching, thx @tastendruecker123 #828
* fix WiFi reconnect not working #851
* updated issue templates #822
## 0.6.2 - 2023-04-04 ## 0.6.2 - 2023-04-04
* fix login from multiple clients #819 * fix login from multiple clients #819
* fix login screen on small displays * fix login screen on small displays

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 6 #define VERSION_MINOR 6
#define VERSION_PATCH 2 #define VERSION_PATCH 3
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

6
src/web/html/includes/header.html

@ -1,5 +1,5 @@
<link rel="stylesheet" type="text/css" href="colors.css"/> <link rel="stylesheet" type="text/css" href="style.css?v={#VERSION}"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8"> <meta charset="UTF-8">
<script type="text/javascript" src="api.js"></script> <script type="text/javascript" src="api.js?v={#VERSION}"></script>
<link rel="stylesheet" type="text/css" href="colors.css?v={#VERSION}"/>

14
src/web/html/includes/nav.html

@ -1,21 +1,21 @@
<div class="topnav"> <div class="topnav">
<a href="/" class="title">AhoyDTU</a> <a href="/?v={#VERSION}" class="title">AhoyDTU</a>
<a href="javascript:void(0);" class="icon" onclick="topnav()"> <a href="javascript:void(0);" class="icon" onclick="topnav()">
<span></span> <span></span>
<span></span> <span></span>
<span></span> <span></span>
</a> </a>
<div id="topnav" class="mobile"> <div id="topnav" class="mobile">
<a id="nav3" class="hide" href="/live">Live</a> <a id="nav3" class="hide" href="/live?v={#VERSION}">Live</a>
<a id="nav4" class="hide" href="/serial">Serial / Control</a> <a id="nav4" class="hide" href="/serial?v={#VERSION}">Serial / Control</a>
<a id="nav5" class="hide" href="/setup">Settings</a> <a id="nav5" class="hide" href="/setup?v={#VERSION}">Settings</a>
<span class="seperator"></span> <span class="seperator"></span>
<a id="nav6" class="hide" href="/update">Update</a> <a id="nav6" class="hide" href="/update?v={#VERSION}">Update</a>
<a id="nav7" class="hide" href="/system">System</a> <a id="nav7" class="hide" href="/system?v={#VERSION}">System</a>
<span class="seperator"></span> <span class="seperator"></span>
<a id="nav8" href="/api" target="_blank">REST API</a> <a id="nav8" href="/api" target="_blank">REST API</a>
<a id="nav9" href="https://ahoydtu.de" target="_blank">Documentation</a> <a id="nav9" href="https://ahoydtu.de" target="_blank">Documentation</a>
<a id="nav10" href="/about">About</a> <a id="nav10" href="/about?v={#VERSION}">About</a>
<span class="seperator"></span> <span class="seperator"></span>
<a id="nav0" class="hide" href="/login">Login</a> <a id="nav0" class="hide" href="/login">Login</a>
<a id="nav1" class="hide" href="/logout">Logout</a> <a id="nav1" class="hide" href="/logout">Logout</a>

85
src/web/web.h

@ -130,11 +130,13 @@ class Web {
bool prot; bool prot;
prot = mProtected; prot = mProtected;
if(!prot) { if(!prot) {
uint8_t ip[4]; if(strlen(mConfig->sys.adminPwd) > 0) {
ah::ip2Arr(ip, request->client()->remoteIP().toString().c_str()); uint8_t ip[4];
for(uint8_t i = 0; i < 4; i++) { ah::ip2Arr(ip, request->client()->remoteIP().toString().c_str());
if(mLoginIp[i] != ip[i]) for(uint8_t i = 0; i < 4; i++) {
prot = true; if(mLoginIp[i] != ip[i])
prot = true;
}
} }
} }
@ -247,17 +249,22 @@ class Web {
} }
} }
void onUpdate(AsyncWebServerRequest *request) { void getPage(AsyncWebServerRequest *request, uint8_t mask, const uint8_t *zippedHtml, uint32_t len) {
DPRINTLN(DBG_VERBOSE, F("onUpdate")); if (CHECK_MASK(mConfig->sys.protectionMask, mask))
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_UPDATE))
checkProtection(request); checkProtection(request);
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), update_html, update_html_len); AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), zippedHtml, len);
response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("Content-Encoding"), "gzip");
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
if(request->hasParam("v"))
response->addHeader(F("Cache-Control"), F("max-age=604800"));
request->send(response); request->send(response);
} }
void onUpdate(AsyncWebServerRequest *request) {
getPage(request, PROT_MASK_UPDATE, update_html, update_html_len);
}
void showUpdate(AsyncWebServerRequest *request) { void showUpdate(AsyncWebServerRequest *request) {
bool reboot = (!Update.hasError()); bool reboot = (!Update.hasError());
@ -302,14 +309,7 @@ class Web {
} }
void onIndex(AsyncWebServerRequest *request) { void onIndex(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, F("onIndex")); getPage(request, PROT_MASK_INDEX, index_html, index_html_len);
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_INDEX))
checkProtection(request);
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), index_html, index_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
request->send(response);
} }
void onLogin(AsyncWebServerRequest *request) { void onLogin(AsyncWebServerRequest *request) {
@ -348,6 +348,9 @@ class Web {
else else
response = request->beginResponse_P(200, F("text/css"), colorBright_css, colorBright_css_len); response = request->beginResponse_P(200, F("text/css"), colorBright_css, colorBright_css_len);
response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("Content-Encoding"), "gzip");
if(request->hasParam("v")) {
response->addHeader(F("Cache-Control"), F("max-age=604800"));
}
request->send(response); request->send(response);
} }
@ -356,6 +359,9 @@ class Web {
mLogoutTimeout = LOGOUT_TIMEOUT; mLogoutTimeout = LOGOUT_TIMEOUT;
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/css"), style_css, style_css_len); AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/css"), style_css, style_css_len);
response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("Content-Encoding"), "gzip");
if(request->hasParam("v")) {
response->addHeader(F("Cache-Control"), F("max-age=604800"));
}
request->send(response); request->send(response);
} }
@ -364,6 +370,8 @@ class Web {
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/javascript"), api_js, api_js_len); AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/javascript"), api_js, api_js_len);
response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("Content-Encoding"), "gzip");
if(request->hasParam("v"))
response->addHeader(F("Cache-Control"), F("max-age=604800"));
request->send(response); request->send(response);
} }
@ -422,14 +430,7 @@ class Web {
} }
void onSetup(AsyncWebServerRequest *request) { void onSetup(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, F("onSetup")); getPage(request, PROT_MASK_SETUP, setup_html, setup_html_len);
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_SETUP))
checkProtection(request);
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), setup_html, setup_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
request->send(response);
} }
void showSave(AsyncWebServerRequest *request) { void showSave(AsyncWebServerRequest *request) {
@ -596,22 +597,16 @@ class Web {
} }
void onLive(AsyncWebServerRequest *request) { void onLive(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, F("onLive")); getPage(request, PROT_MASK_LIVE, visualization_html, visualization_html_len);
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_LIVE))
checkProtection(request);
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), visualization_html, visualization_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
request->send(response);
} }
void onAbout(AsyncWebServerRequest *request) { void onAbout(AsyncWebServerRequest *request) {
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len); AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len);
response->addHeader(F("Content-Encoding"), "gzip"); response->addHeader(F("Content-Encoding"), "gzip");
response->addHeader(F("content-type"), "text/html; charset=UTF-8"); response->addHeader(F("content-type"), "text/html; charset=UTF-8");
if(request->hasParam("v")) {
response->addHeader(F("Cache-Control"), F("max-age=604800"));
}
request->send(response); request->send(response);
} }
@ -623,25 +618,11 @@ class Web {
} }
void onSerial(AsyncWebServerRequest *request) { void onSerial(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, F("onSerial")); getPage(request, PROT_MASK_SERIAL, serial_html, serial_html_len);
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_SERIAL))
checkProtection(request);
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), serial_html, serial_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
request->send(response);
} }
void onSystem(AsyncWebServerRequest *request) { void onSystem(AsyncWebServerRequest *request) {
DPRINTLN(DBG_VERBOSE, F("onSystem")); getPage(request, PROT_MASK_SYSTEM, system_html, system_html_len);
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_SYSTEM))
checkProtection(request);
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
request->send(response);
} }

6
src/wifi/ahoywifi.cpp

@ -25,6 +25,7 @@ void ahoywifi::setup(settings_t *config, uint32_t *utcTimestamp, appWifiCb cb) {
mStaConn = DISCONNECTED; mStaConn = DISCONNECTED;
mCnt = 0; mCnt = 0;
mScanActive = false; mScanActive = false;
mScanCnt = 0;
#if defined(ESP8266) #if defined(ESP8266)
wifiConnectHandler = WiFi.onStationModeConnected(std::bind(&ahoywifi::onConnect, this, std::placeholders::_1)); wifiConnectHandler = WiFi.onStationModeConnected(std::bind(&ahoywifi::onConnect, this, std::placeholders::_1));
@ -109,7 +110,7 @@ void ahoywifi::tickWifiLoop() {
DBGPRINTLN(F(" seconds")); DBGPRINTLN(F(" seconds"));
if(mScanActive) { if(mScanActive) {
getBSSIDs(); getBSSIDs();
if(!mScanActive) // scan completed if((!mScanActive) && (!mBSSIDList.empty())) // scan completed
if ((mCnt % timeout) < timeout - 2) if ((mCnt % timeout) < timeout - 2)
mCnt = timeout - 2; mCnt = timeout - 2;
} }
@ -297,8 +298,7 @@ void ahoywifi::getAvailNetworks(JsonObject obj) {
void ahoywifi::getBSSIDs() { void ahoywifi::getBSSIDs() {
int n = WiFi.scanComplete(); int n = WiFi.scanComplete();
if (n < 0) { if (n < 0) {
mScanCnt++; if (++mScanCnt < 20)
if (mScanCnt < 20)
return; return;
} }
if(n > 0) { if(n > 0) {

Loading…
Cancel
Save