44 Commits

Author SHA1 Message Date
ce8e8bbe7b Merge branch 'dev' of https://github.com/mp-se/gravitymon into dev 2022-10-18 19:30:55 +02:00
0ca60ec71f GitHub Action Build 2022-10-18 17:21:00 +00:00
d7981851bd Update readme 2022-10-18 19:19:25 +02:00
2a419c10d1 Update 2022-10-18 19:04:05 +02:00
b265dba422 Merge 2022-10-18 19:01:41 +02:00
74a0598905 Merge 2022-10-18 19:00:53 +02:00
3b7be30363 Merge branch 'master' into dev 2022-10-18 19:00:28 +02:00
5889ebda1e Bump doc version 2022-10-18 18:57:06 +02:00
ec77b873a8 Update build targets 2022-10-18 18:55:03 +02:00
04120a0490 Removed obsolete files from bin 2022-10-18 18:08:47 +02:00
b5928cb201 GitHub Action Build 2022-10-17 19:07:44 +00:00
22f9a2d228 Fix precommit 2022-10-17 21:03:12 +02:00
343aea7ebe Fix sluggish webserver 2022-10-17 21:02:19 +02:00
19e67cb678 Refactor html serving 2022-10-17 21:02:08 +02:00
379dff1d22 Fix updated path 2022-10-17 20:34:59 +02:00
e82cd2aeae Fix build errors 2022-10-17 20:27:22 +02:00
6262cec27d Update esp32c3 support 2022-10-17 20:19:20 +02:00
a9347c7e03 Removed warning from wifi lib 2022-10-16 20:40:41 +02:00
60adcabd81 Fixed conflict with logging library 2022-10-16 20:40:08 +02:00
411cec08c7 Added macro for controling serial port 2022-10-16 20:39:27 +02:00
b6fcf94191 Updated install docs 2022-10-16 20:34:57 +02:00
e9ef632cce Added docs on esp32 2022-10-16 10:46:09 +02:00
7d4c42a47c Added new targets to UI 2022-10-16 10:16:16 +02:00
9ce6d54b80 Updated i2c lib for esp32 2022-10-16 09:23:51 +02:00
2e96e4aea8 Updated esp32 debug target 2022-10-15 17:42:50 +02:00
775ba53260 Update release notes 2022-10-15 17:41:41 +02:00
6e0af97574 Disable BLE for ESP32S2 2022-10-15 17:41:17 +02:00
531baa917e Added c3 targets to bin folder 2022-10-14 19:39:38 +02:00
7f73f22759 Docs update 2022-10-14 19:39:01 +02:00
0fad08ccc5 Added log entry when doing factory reset 2022-10-14 19:38:41 +02:00
fcfc8df625 Reading wifi creds from eeprom, fixed ota filenames 2022-10-14 19:38:04 +02:00
e54c1d2518 Fixed bug in template engine, not including the start of tempalte 2022-10-14 19:37:14 +02:00
027e98d2de Update board pins 2022-10-14 19:36:36 +02:00
91227b0728 Added esp32 reset reason 2022-10-14 19:36:01 +02:00
ddeca29f8e Update targets 2022-10-14 19:35:39 +02:00
15d3371437 Updated pins for new boards 2022-10-12 23:26:17 +02:00
ac51c52c74 Moved global classes to main 2022-10-12 19:52:44 +02:00
1148a23bb4 Added c3 target 2022-10-12 19:52:15 +02:00
1ddd8bc669 Removed upload functions (not used) 2022-10-12 19:51:38 +02:00
7664215d23 Limit wifi power on esp32c3 2022-10-12 19:30:49 +02:00
9eb356bd43 Upgrade wifi libs 2022-10-12 19:26:24 +02:00
d1b94ce2b0 GitHub Action Build 2022-08-21 17:59:36 +00:00
d4b78a0e1b Showing wifi ssid in config 2022-08-21 18:48:08 +02:00
646d8f8d12 Added copy button to docs 2022-08-21 18:39:46 +02:00
68 changed files with 843 additions and 1775 deletions

View File

@ -21,6 +21,7 @@ jobs:
pip install docutils==0.16
pip install pygments==2.11.1
pip install furo==2022.1.2
pip install sphinx-copybutton
pip list
build-command: "sphinx-build -b html ./source ../docs"

View File

@ -36,7 +36,7 @@ jobs:
git config --global advice.detachedHead false
- name: Run PlatformIO
run: pio run -e gravity-release -e gravity-perf -e gravity32-release -e gravity32-perf
run: pio run -e gravity-release -e gravity32-release -e gravity32c3-release
- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version. https://github.com/marketplace/actions/add-commit
with:

View File

@ -10,7 +10,7 @@
GravityMon is a replacement firmware for the iSpindle firmware. It's 100% compatible with the iSpindle hardware design so it does not require any hardware changes.
Now also works with ESP32 (use ESP32 d1 mini which is compatible with ESP8266)
Now also works with ESP32, either an ESP32 d1 mini or ESP32 c3 mini which both are compatible with ESP8266.
Installation can be made using https://www.brewflasher.com or https://web.brewflasher.com

View File

@ -1 +0,0 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content=""><title>Beer Gravity Monitor</title><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"><style>.row-margin-10{margin-top:1em}</style></head><body class="py-4"><!-- START MENU --><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script><nav class="navbar navbar-expand-lg navbar-dark bg-primary"><div class="container"><a class="navbar-brand" href="/index.htm">Beer Gravity Monitor</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbarNav"><ul class="navbar-nav"><li class="nav-item"><a class="nav-link" href="/index.htm">Home</a></li><li class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Configuration</a><ul class="dropdown-menu"><li><a class="dropdown-item" href="/config.htm">Configuration</a></li><li><a class="dropdown-item" href="/format.htm">Format editor</a></li><li><a class="dropdown-item" href="/test.htm">Test push</a></li><li><a class="dropdown-item" href="/firmware.htm">Upload firmware</a></li></ul></li><li class="nav-item"><a class="nav-link" href="/calibration.htm">Calibration</a></li><li class="nav-item"><a class="nav-link active" href="#">About</a></li></ul></div><div class="spinner-border text-light" id="spinner" role="status"></div></div></nav><!-- START BODY --><div class="container row-margin-10"><div class="accordion row-margin-10" id="accordion"><div class="accordion-item"><h2 class="accordion-header" id="headingAbout"><button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseAbout" aria-expanded="true" aria-controls="collapseAbout"><b>About</b></button></h2><div id="collapseAbout" class="accordion-collapse collapse show" aria-labelledby="headingAbout" data-bs-parent="#accordion"><div class="accordion-body"><div class="row h3 col-sm-8">Beer Gravity Monitor</div><div class="row col-sm-8 mb-3">This is a piece of software for the iSpindle hardware and will work in a similar way. No part of this software is copied from the iSpindle project.</div><div class="row h3 col-sm-8 mb-3">MIT License</div><div class="row col-sm-8 mb-3">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</div><div class="row h3 col-sm-8 mb-3">Credits to</div><div class="row col-sm-8 mb-3">This software uses the following libraries and without these this software would have been much more difficult to acheive:<br><br><ul><li>https://github.com/jrowberg/i2cdevlib</li><li>https://github.com/codeplea/tinyexpr</li><li>https://github.com/graphitemaster/incbin</li><li>https://github.com/khoih-prog/ESP_DoubleResetDetector</li><li>https://github.com/khoih-prog/ESP_WiFiManager</li><li>https://github.com/thijse/Arduino-Log</li><li>https://github.com/bblanchon/ArduinoJson</li><li>https://github.com/PaulStoffregen/OneWire</li><li>https://github.com/milesburton/Arduino-Temperature-Control-Library</li><li>https://github.com/Rotario</li><li>https://github.com/256dpi/arduino-mqtt</li><li>https://graphjs.com</li><li>https://getbootstrap.com</li><li>https://github.com/lorol/LITTLEFS</li><li>https://github.com/h2zero/NimBLE-Arduino</li><li>https://github.com/spouliot/tilt-sim</li></ul></div></div></div></div></div></div><!-- START FOOTER --><div class="container themed-container bg-primary text-light row-margin-10">(C) Copyright 2021-22 Magnus Persson</div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/firmware32c3.bin Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
bin/partitions32c3.bin Normal file

Binary file not shown.

View File

@ -1 +1 @@
{ "project":"gravmon", "version":"1.1.0", "html": [ ] }
{ "project":"gravmon", "version":"1.2.0", "html": [ ] }

35
ex/exception_dump.txt Normal file
View File

@ -0,0 +1,35 @@
User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Panic core_esp8266_main.cpp:215 loop_task
>>>stack>>>
ctx: sys
sp: 3fffff10 end: 3fffffb0 offset: 0000
3fffff10: 00000000 02ac3bd9 40280793 3ffeaec4
3fffff20: 000000fe 00000000 00000000 00000000
3fffff30: 00000000 00000000 00000000 3fff1edc
3fffff40: 3fff1fa8 3fff1fa8 3fff0280 3fff1e94
3fffff50: 3fffdad0 00000000 3ffe8648 4022d992
3fffff60: 402854b2 3fffdab0 00000000 4022d9ff
3fffff70: 00000000 3fffdad0 3fff1e94 4022d0d8
3fffff80: 40000f49 40000f49 3fffdab0 40000f49
3fffff90: 40000e19 000b5a21 00000000 00000005
3fffffa0: 00000000 aa55aa55 000000d0 401057f9
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v000b5a30
~ld

View File

@ -152,6 +152,21 @@
<hr class="my-2">
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Wifi</label>
<div class="col-sm-2">
<label class="col-sm-4 col-form-label" id="wifi-ssid"></label>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Wifi 2</label>
<div class="col-sm-2">
<label class="col-sm-4 col-form-label" id="wifi-ssid2"></label>
</div>
</div>
<hr class="my-2">
<div class="row mb-3">
<label for="calibrate-btn" class="col-sm-2 col-form-label">Current calibration</label>
<label for="calibrate-btn" class="col-sm-2 col-form-label" id="gyro-calibration-data">Loading...</label>
@ -854,7 +869,7 @@
$.getJSON(url, function (cfg) {
console.log( cfg );
if(cfg["platform"]=="esp32") {
if(cfg["platform"]=="esp32" || cfg["platform"]=="esp32c3") {
$('#ble').prop('disabled', false);
$("#ble").val(cfg["ble"]);
}
@ -901,6 +916,8 @@
$("#angle").text(cfg["angle"]);
$("#runtime-average").val(cfg["runtime-average"]);
$("#water-angle").text( "(Water angle: " + cfg["formula-calculation-data"]["a1"] + ") - default off");
$("#wifi-ssid").text(cfg["wifi-ssid"]);
$("#wifi-ssid2").text(cfg["wifi-ssid2"]);
//$("#gravity").text(cfg["gravity"] + " SG");
})
.fail(function () {

File diff suppressed because one or more lines are too long

View File

@ -1,179 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<title>Beer Gravity Monitor</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<style>
.row-margin-10 { margin-top: 1.0em; }
</style>
</head>
<body class="py-4">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<!-- START MENU -->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="/index.htm">Beer Gravity Monitor</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="spinner-border text-light" id="spinner" role="status"></div>
</div>
</nav>
<!-- START MAIN INDEX -->
<div class="container row-margin-10">
<div class="alert alert-success alert-dismissible hide fade d-none" role="alert">
<div id="alert"></div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<script type="text/javascript">
function showError( msg ) {
$('.alert').removeClass('alert-success').addClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
$('#alert').text( msg );
}
function showSuccess( msg ) {
$('.alert').addClass('alert-success').removeClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
$('#alert').text( msg );
}
$("#alert-btn").click(function(e){
$('.alert').addClass('hide').removeClass('show').addClass('d-none');
});
</script>
<div class="accordion" id="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="headingUpload">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseUpload" aria-expanded="true" aria-controls="collapseUpload">
<b>Upload missing html files</b>
</button>
</h2>
<div id="collapseUpload" class="accordion-collapse collapse show" aria-labelledby="headingUpload" data-bs-parent="#accordion">
<div class="accordion-body">
<div class="row mb-3">
<div class="col-md-8 bg-light">The listed files below needs to be uploaded to the FileSystem in order for the GUI to work.
You can also flash the LittleFS filesystem but in that case you will loose your device settings. An OTA upgrade will automatically download
the files if they are found in the same location as the firmware.bin. This page is a fallback option.
</div>
<div class="col-md-8 bg-light"><br><strong>Once all the files are confirmed, please reboot the device for normal operation.</strong></div>
</div>
<div class="row mb-3">
<div class="col-md-2 bg-light">index.min.htm</div>
<div class="col-md-6 bg-light" id="index">Checking...</div>
</div>
<div class="row mb-3">
<div class="col-md-2 bg-light">config.min.htm</div>
<div class="col-md-6 bg-light" id="config">Checking...</div>
</div>
<div class="row mb-3">
<div class="col-md-2 bg-light">calibration.min.htm</div>
<div class="col-md-6 bg-light" id="calibration">Checking...</div>
</div>
<div class="row mb-3">
<div class="col-md-2 bg-light">format.min.htm</div>
<div class="col-md-6 bg-light" id="format">Checking...</div>
</div>
<div class="row mb-3">
<div class="col-md-2 bg-light">test.min.htm</div>
<div class="col-md-6 bg-light" id="test">Checking...</div>
</div>
<div class="row mb-3">
<div class="col-md-2 bg-light">about.min.htm</div>
<div class="col-md-6 bg-light" id="about">Checking...</div>
</div>
<form action="/api/upload" method="post" enctype="multipart/form-data">
<div class="row mb-3">
<div class="col-md-8 custom-file">
<input type="file" accept=".min.htm" class="custom-file-input" name="name" id="name" data-bs-toggle="tooltip" title="Select a file that matches the name in the list above to upload it to the device">
</div>
</div>
<div class="row mb-3">
<div class="col-md-3">
<button type="submit" class="btn btn-primary" id="upload-btn" value="upload" data-bs-toggle="tooltip" title="Upload the selected file to the device">Upload</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.onload = getUpload;
// Add the following code if you want the name of the file appear on select
$(".custom-file-input").on("change", function() {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});
function getUpload() {
var url = "/api/upload";
//var url = "/test/upload.json";
$('#spinner').show();
$.getJSON(url, function (cfg) {
console.log( cfg );
if( cfg["index"] )
$("#index").text("Completed.");
else
$("#index").text("File is missing.");
if( cfg["config"] )
$("#config").text("Completed.");
else
$("#config").text("File is missing.");
if( cfg["calibration"] )
$("#calibration").text("Completed.");
else
$("#calibration").text("File is missing.");
if( cfg["test"] )
$("#test").text("Completed.");
else
$("#test").text("File is missing.");
if( cfg["format"] )
$("#format").text("Completed.");
else
$("#format").text("File is missing.");
if( cfg["about"] )
$("#about").text("Completed.");
else
$("#about").text("File is missing.");
})
.fail(function () {
showError('Unable to get data from the device.');
})
.always(function() {
$('#spinner').hide();
});
}
</script>
<!-- START FOOTER -->
<div class="container themed-container bg-primary text-light row-margin-10">(C) Copyright 2021-22 Magnus Persson</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_DoubleResetDetector
Licensed under MIT license
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
@ -24,6 +24,7 @@
1.2.1 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.3.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Add waitingForDRD() function to signal in DRD wating period
1.3.2 K Hoang 09/09/2022 Fix ESP32 chipID for example ConfigOnDoubleReset
*****************************************************************************************************************************/
#pragma once
@ -42,13 +43,13 @@
#endif
#ifndef ESP_DOUBLE_RESET_DETECTOR_VERSION
#define ESP_DOUBLE_RESET_DETECTOR_VERSION "ESP_DoubleResetDetector v1.3.1"
#define ESP_DOUBLE_RESET_DETECTOR_VERSION "ESP_DoubleResetDetector v1.3.2"
#define ESP_DOUBLE_RESET_DETECTOR_VERSION_MAJOR 1
#define ESP_DOUBLE_RESET_DETECTOR_VERSION_MINOR 3
#define ESP_DOUBLE_RESET_DETECTOR_VERSION_PATCH 1
#define ESP_DOUBLE_RESET_DETECTOR_VERSION_PATCH 2
#define ESP_DOUBLE_RESET_DETECTOR_VERSION_INT 1003001
#define ESP_DOUBLE_RESET_DETECTOR_VERSION_INT 1003002
#endif
#define ESP_DOUBLERESETDETECTOR_VERSION ESP_DOUBLE_RESET_DETECTOR_VERSION

View File

@ -16,47 +16,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
Licensed under MIT license
Version: 1.8.0
Version: 1.11.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 07/10/2019 Initial coding
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
Add, enhance examples (fix MDNS for ESP32)
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings.
1.1.0 K Hoang 28/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime
1.1.1 K Hoang 30/08/2020 Add setCORSHeader function to allow flexible CORS. Fix typo and minor improvement.
1.1.2 K Hoang 17/08/2020 Fix bug. Add example.
1.2.0 K Hoang 09/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
1.4.1 K Hoang 22/12/2020 Fix staticIP not saved. Add functions. Add complex examples. Sync with ESPAsync_WiFiManager
1.4.2 K Hoang 14/01/2021 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
1.4.3 K Hoang 23/01/2021 Fix examples' bug not saving Static IP in certain cases.
1.5.0 K Hoang 12/02/2021 Add support to new ESP32-S2
1.5.1 K Hoang 26/03/2021 Fix compiler error if setting Compiler Warnings to All. Retest with esp32 core v1.0.6
1.5.2 K Hoang 08/04/2021 Fix example misleading messages.
1.5.3 K Hoang 13/04/2021 Add dnsServer error message.
1.6.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
1.6.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1
1.7.0 K Hoang 06/05/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
1.7.1 K Hoang 08/05/2021 Fix Json bug. Fix timezoneName not displayed in Info page.
1.7.2 K Hoang 08/05/2021 Fix warnings with ESP8266 core v3.0.0
1.7.3 K Hoang 29/07/2021 Fix MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
1.7.4 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
1.7.5 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug
1.8.0 K Hoang 29/12/2021 Enable compatibility with old code to include only ESP_WiFiManager.h
...
1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
*****************************************************************************************************************************/
#pragma once
@ -80,7 +51,7 @@ ESP_WMParameter::ESP_WMParameter(const char *custom)
//////////////////////////////////////////
ESP_WMParameter::ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement)
ESP_WMParameter::ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, const int& length, const char *custom, const int& labelPlacement)
{
init(id, placeholder, defaultValue, length, custom, labelPlacement);
}
@ -94,7 +65,7 @@ ESP_WMParameter::ESP_WMParameter(const WMParam_Data& WMParam_data)
//////
//////////////////////////////////////////
void ESP_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement)
void ESP_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue, const int& length, const char *custom, const int& labelPlacement)
{
_WMParam_data._id = id;
_WMParam_data._placeholder = placeholder;
@ -252,7 +223,8 @@ ESP_WiFiManager::ESP_WiFiManager(const char *iHostname)
#ifdef ESP8266
String _hostname = "ESP8266-" + String(ESP.getChipId(), HEX);
#else //ESP32
String _hostname = "ESP32-" + String((uint32_t)ESP.getEfuseMac(), HEX);
String _hostname = "ESP32-" + String(ESP_getChipId(), HEX);
#endif
_hostname.toUpperCase();
@ -461,7 +433,8 @@ bool ESP_WiFiManager::autoConnect()
#ifdef ESP8266
String ssid = "ESP_" + String(ESP.getChipId());
#else //ESP32
String ssid = "ESP_" + String((uint32_t)ESP.getEfuseMac());
String ssid = "ESP_" + String(ESP_getChipId());
#endif
return autoConnect(ssid.c_str(), NULL);
@ -522,7 +495,7 @@ bool ESP_WiFiManager::startConfigPortal()
#ifdef ESP8266
String ssid = "ESP_" + String(ESP.getChipId());
#else //ESP32
String ssid = "ESP_" + String((uint32_t)ESP.getEfuseMac());
String ssid = "ESP_" + String(ESP_getChipId());
#endif
ssid.toUpperCase();
@ -864,7 +837,7 @@ void ESP_WiFiManager::startWPS()
//Convenient for debugging but wasteful of program space.
//Remove if short of space
const char* ESP_WiFiManager::getStatus(int status)
const char* ESP_WiFiManager::getStatus(const int& status)
{
switch (status)
{
@ -920,21 +893,21 @@ void ESP_WiFiManager::resetSettings()
//////////////////////////////////////////
void ESP_WiFiManager::setTimeout(unsigned long seconds)
void ESP_WiFiManager::setTimeout(const unsigned long& seconds)
{
setConfigPortalTimeout(seconds);
}
//////////////////////////////////////////
void ESP_WiFiManager::setConfigPortalTimeout(unsigned long seconds)
void ESP_WiFiManager::setConfigPortalTimeout(const unsigned long& seconds)
{
_configPortalTimeout = seconds * 1000;
}
//////////////////////////////////////////
void ESP_WiFiManager::setConnectTimeout(unsigned long seconds)
void ESP_WiFiManager::setConnectTimeout(const unsigned long& seconds)
{
_connectTimeout = seconds * 1000;
}
@ -949,7 +922,7 @@ void ESP_WiFiManager::setDebugOutput(bool debug)
//////////////////////////////////////////
// KH, new from v1.0.10 to enable dynamic/random channel
int ESP_WiFiManager::setConfigPortalChannel(int channel)
int ESP_WiFiManager::setConfigPortalChannel(const int& channel)
{
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
// If channel == 0 => will use random channel from MIN_WIFI_CHANNEL to MAX_WIFI_CHANNEL
@ -1037,7 +1010,7 @@ void ESP_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAddress&
//////////////////////////////////////////
void ESP_WiFiManager::setMinimumSignalQuality(int quality)
void ESP_WiFiManager::setMinimumSignalQuality(const int& quality)
{
_minimumQuality = quality;
}
@ -1392,6 +1365,11 @@ void ESP_WiFiManager::handleWifiSave()
_pass1 = server->arg("p1").c_str();
///////////////////////
#if USING_CORS_FEATURE
// New from v1.10.2, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
#endif
#if USE_ESP_WIFIMANAGER_NTP
@ -1584,10 +1562,23 @@ void ESP_WiFiManager::handleInfo()
page += F("<table class=\"table\">");
page += F("<thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td>Chip ID</td><td>");
page += F("0x");
#ifdef ESP8266
page += String(ESP.getChipId(), HEX); //ESP.getChipId();
#else //ESP32
page += String((uint32_t)ESP.getEfuseMac(), HEX); //ESP.getChipId();
page += String(ESP_getChipId(), HEX); //ESP.getChipId();
page += F("</td></tr>");
page += F("<tr><td>Chip OUI</td><td>");
page += F("0x");
page += String(getChipOUI(), HEX); //ESP.getChipId();
page += F("</td></tr>");
page += F("<tr><td>Chip Model</td><td>");
page += ESP.getChipModel();
page += F(" Rev");
page += ESP.getChipRevision();
#endif
page += F("</td></tr>");
@ -2019,7 +2010,7 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
//////////////////////////////////////////
int ESP_WiFiManager::getRSSIasQuality(int RSSI)
int ESP_WiFiManager::getRSSIasQuality(const int& RSSI)
{
int quality = 0;
@ -2116,6 +2107,31 @@ String ESP_WiFiManager::getStoredWiFiPass()
return String(reinterpret_cast<char*>(conf.sta.password));
}
uint32_t getChipID()
{
uint64_t chipId64 = 0;
for (int i = 0; i < 6; i++)
{
chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8);
}
return (uint32_t) (chipId64 & 0xFFFFFF);
}
uint32_t getChipOUI()
{
uint64_t chipId64 = 0;
for (int i = 0; i < 6; i++)
{
chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8);
}
return (uint32_t) (chipId64 >> 24);
}
#endif

View File

@ -16,48 +16,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
Licensed under MIT license
Version: 1.9.0
Version: 1.11.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 07/10/2019 Initial coding
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
Add, enhance examples (fix MDNS for ESP32)
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings.
1.1.0 K Hoang 28/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime
1.1.1 K Hoang 30/08/2020 Add setCORSHeader function to allow flexible CORS. Fix typo and minor improvement.
1.1.2 K Hoang 17/08/2020 Fix bug. Add example.
1.2.0 K Hoang 09/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
1.4.1 K Hoang 22/12/2020 Fix staticIP not saved. Add functions. Add complex examples. Sync with ESPAsync_WiFiManager
1.4.2 K Hoang 14/01/2021 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
1.4.3 K Hoang 23/01/2021 Fix examples' bug not saving Static IP in certain cases.
1.5.0 K Hoang 12/02/2021 Add support to new ESP32-S2
1.5.1 K Hoang 26/03/2021 Fix compiler error if setting Compiler Warnings to All. Retest with esp32 core v1.0.6
1.5.2 K Hoang 08/04/2021 Fix example misleading messages.
1.5.3 K Hoang 13/04/2021 Add dnsServer error message.
1.6.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
1.6.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1
1.7.0 K Hoang 06/05/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
1.7.1 K Hoang 08/05/2021 Fix Json bug. Fix timezoneName not displayed in Info page.
1.7.2 K Hoang 08/05/2021 Fix warnings with ESP8266 core v3.0.0
1.7.3 K Hoang 29/07/2021 Fix MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
1.7.4 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
1.7.5 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug
...
1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
*****************************************************************************************************************************/
#pragma once

View File

@ -16,48 +16,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
Licensed under MIT license
Version: 1.9.0
Version: 1.11.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 07/10/2019 Initial coding
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
Add, enhance examples (fix MDNS for ESP32)
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings.
1.1.0 K Hoang 28/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime
1.1.1 K Hoang 30/08/2020 Add setCORSHeader function to allow flexible CORS. Fix typo and minor improvement.
1.1.2 K Hoang 17/08/2020 Fix bug. Add example.
1.2.0 K Hoang 09/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
1.4.1 K Hoang 22/12/2020 Fix staticIP not saved. Add functions. Add complex examples. Sync with ESPAsync_WiFiManager
1.4.2 K Hoang 14/01/2021 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
1.4.3 K Hoang 23/01/2021 Fix examples' bug not saving Static IP in certain cases.
1.5.0 K Hoang 12/02/2021 Add support to new ESP32-S2
1.5.1 K Hoang 26/03/2021 Fix compiler error if setting Compiler Warnings to All. Retest with esp32 core v1.0.6
1.5.2 K Hoang 08/04/2021 Fix example misleading messages.
1.5.3 K Hoang 13/04/2021 Add dnsServer error message.
1.6.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
1.6.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1
1.7.0 K Hoang 06/05/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
1.7.1 K Hoang 08/05/2021 Fix Json bug. Fix timezoneName not displayed in Info page.
1.7.2 K Hoang 08/05/2021 Fix warnings with ESP8266 core v3.0.0
1.7.3 K Hoang 29/07/2021 Fix MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
1.7.4 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
1.7.5 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug
...
1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
*****************************************************************************************************************************/
#pragma once
@ -70,33 +40,48 @@
#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \
ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \
ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM )
#warning Using ESP32_S2. To follow library instructions to install esp32-s2 core and WebServer Patch
#warning You have to select HUGE APP or 1.9-2.0 MB APP to be able to run Config Portal. Must use PSRAM
#if (_WIFIMGR_LOGLEVEL_ > 3)
#warning Using ESP32_S2. To follow library instructions to install esp32-s2 core and WebServer Patch
#warning You have to select HUGE APP or 1.9-2.0 MB APP to be able to run Config Portal. Must use PSRAM
#endif
#define USING_ESP32_S2 true
#elif ( ARDUINO_ESP32C3_DEV )
#warning Using ESP32_C3. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK.
#warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards
#if (_WIFIMGR_LOGLEVEL_ > 3)
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
#warning Using ESP32_C3 using core v2.0.0+. Either LittleFS, SPIFFS or EEPROM OK.
#else
#warning Using ESP32_C3 using core v1.0.6-. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK.
#endif
#endif
// #warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards
#define USING_ESP32_C3 true
#elif ( defined(ARDUINO_ESP32S3_DEV) || defined(ARDUINO_ESP32_S3_BOX) || defined(ARDUINO_TINYS3) || \
defined(ARDUINO_PROS3) || defined(ARDUINO_FEATHERS3) )
#if (_WIFIMGR_LOGLEVEL_ > 3)
#warning Using ESP32_S3. To install esp32-s3-support branch if using core v2.0.2-
#endif
#define USING_ESP32_S3 true
#endif
#define ESP_WIFIMANAGER_VERSION "ESP_WiFiManager v1.9.0"
#define ESP_WIFIMANAGER_VERSION "ESP_WiFiManager v1.11.0"
#define ESP_WIFIMANAGER_VERSION_MAJOR 1
#define ESP_WIFIMANAGER_VERSION_MINOR 9
#define ESP_WIFIMANAGER_VERSION_MINOR 11
#define ESP_WIFIMANAGER_VERSION_PATCH 0
#define ESP_WIFIMANAGER_VERSION_INT 1009000
#define ESP_WIFIMANAGER_VERSION_INT 1011000
#include "ESP_WiFiManager_Debug.h"
#if ( defined(HTTP_PORT) && (HTTP_PORT < 65536) && (HTTP_PORT > 0) )
#if (_WIFIMGR_LOGLEVEL_ > 2)
#if (_WIFIMGR_LOGLEVEL_ > 3)
#warning Using custom HTTP_PORT
#endif
#define HTTP_PORT_TO_USE HTTP_PORT
#else
#if (_WIFIMGR_LOGLEVEL_ > 2)
#if (_WIFIMGR_LOGLEVEL_ > 3)
#warning Using default HTTP_PORT = 80
#endif
@ -126,9 +111,20 @@
}
#define ESP_getChipId() (ESP.getChipId())
#else //ESP32
#include <esp_wifi.h>
#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac())
uint32_t getChipID();
uint32_t getChipOUI();
#if defined(ESP_getChipId)
#undef ESP_getChipId
#endif
#define ESP_getChipId() getChipID() // ((uint32_t)ESP.getEfuseMac())
#define ESP_getChipOUI() getChipOUI() // ((uint32_t)ESP.getEfuseMac())
#endif
// New in v1.4.0
@ -199,7 +195,10 @@ const char WM_HTTP_SCRIPT_NTP_HIDDEN[] PROGMEM = "<p><input type='hidden' id='ti
#if !(USE_CLOUDFLARE_NTP)
#undef USE_CLOUDFLARE_NTP
#define USE_CLOUDFLARE_NTP true
#warning Forcing USE_CLOUDFLARE_NTP for ESP8266 as low memory can cause blank page
#if (_WIFIMGR_LOGLEVEL_ > 3)
#warning Forcing USE_CLOUDFLARE_NTP for ESP8266 as low memory can cause blank page
#endif
#endif
#endif
@ -291,8 +290,8 @@ class ESP_WMParameter
{
public:
ESP_WMParameter(const char *custom);
ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, int length,
const char *custom = "", int labelPlacement = WFM_LABEL_BEFORE);
ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, const int& length,
const char *custom = "", const int& labelPlacement = WFM_LABEL_BEFORE);
// New in v1.4.0
ESP_WMParameter(const WMParam_Data& WMParam_data);
@ -302,7 +301,7 @@ class ESP_WMParameter
// New in v1.4.0
void setWMParam_Data(const WMParam_Data& WMParam_data);
void getWMParam_Data(WMParam_Data &WMParam_data);
void getWMParam_Data(WMParam_Data& WMParam_data);
//////
const char *getID();
@ -318,7 +317,8 @@ class ESP_WMParameter
const char *_customHTML;
void init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement);
void init(const char *id, const char *placeholder, const char *defaultValue, const int& length,
const char *custom, const int& labelPlacement);
friend class ESP_WiFiManager;
};
@ -359,27 +359,27 @@ class ESP_WiFiManager
//sets timeout before webserver loop ends and exits even if there has been no setup.
//usefully for devices that failed to connect at some point and got stuck in a webserver loop
//in seconds setConfigPortalTimeout is a new name for setTimeout
void setConfigPortalTimeout(unsigned long seconds);
void setTimeout(unsigned long seconds);
void setConfigPortalTimeout(const unsigned long& seconds);
void setTimeout(const unsigned long& seconds);
//sets timeout for which to attempt connecting, usefull if you get a lot of failed connects
void setConnectTimeout(unsigned long seconds);
void setConnectTimeout(const unsigned long& seconds);
void setDebugOutput(bool debug);
//defaults to not showing anything under 8% signal quality if called
void setMinimumSignalQuality(int quality = 8);
void setMinimumSignalQuality(const int& quality = 8);
// KH, new from v1.0.10 to enable dynamic/random channel
int setConfigPortalChannel(int channel = 1);
int setConfigPortalChannel(const int& channel = 1);
//////
//sets a custom ip /gateway /subnet configuration
void setAPStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn);
// New in v1.4.0
void setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig);
void getAPStaticIPConfig(WiFi_AP_IPConfig &WM_AP_IPconfig);
void setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig);
void getAPStaticIPConfig(WiFi_AP_IPConfig& WM_AP_IPconfig);
//////
//sets config for a static IP
@ -387,7 +387,7 @@ class ESP_WiFiManager
// New in v1.4.0
void setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig);
void getSTAStaticIPConfig(WiFi_STA_IPConfig &WM_STA_IPconfig);
void getSTAStaticIPConfig(WiFi_STA_IPConfig& WM_STA_IPconfig);
//////
#if USE_CONFIGURABLE_DNS
@ -447,7 +447,7 @@ class ESP_WiFiManager
#define MAX_WIFI_CREDENTIALS 2
String getSSID(uint8_t index)
String getSSID(const uint8_t& index)
{
if (index == 0)
return _ssid;
@ -457,7 +457,7 @@ class ESP_WiFiManager
return String("");
}
String getPW(uint8_t index)
String getPW(const uint8_t& index)
{
if (index == 0)
return _pass;
@ -488,7 +488,7 @@ class ESP_WiFiManager
// returns the Parameters Count
int getParametersCount();
const char* getStatus(int status);
const char* getStatus(const int& status);
#ifdef ESP32
String getStoredWiFiSSID();
@ -605,7 +605,7 @@ class ESP_WiFiManager
void setupConfigPortal();
void startWPS();
//const char* getStatus(int status);
//const char* getStatus(const int& status);
const char* _apName = "no-net";
const char* _apPassword = NULL;
@ -686,13 +686,13 @@ class ESP_WiFiManager
void handleNotFound();
bool captivePortal();
void reportStatus(String &page);
void reportStatus(String& page);
// DNS server
const byte DNS_PORT = 53;
//helpers
int getRSSIasQuality(int RSSI);
int getRSSIasQuality(const int& RSSI);
bool isIp(const String& str);
String toStringIp(const IPAddress& ip);
@ -715,10 +715,13 @@ class ESP_WiFiManager
void DEBUG_WM(Generic text);
template <class T>
auto optionalIPFromString(T *obj, const char *s) -> decltype(obj->fromString(s)) {
auto optionalIPFromString(T *obj, const char *s) -> decltype(obj->fromString(s))
{
return obj->fromString(s);
}
auto optionalIPFromString(...) -> bool {
auto optionalIPFromString(...) -> bool
{
LOGINFO("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work.");
return false;
}

View File

@ -16,48 +16,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
Licensed under MIT license
Version: 1.9.0
Version: 1.11.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 07/10/2019 Initial coding
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
Add, enhance examples (fix MDNS for ESP32)
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings.
1.1.0 K Hoang 28/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime
1.1.1 K Hoang 30/08/2020 Add setCORSHeader function to allow flexible CORS. Fix typo and minor improvement.
1.1.2 K Hoang 17/08/2020 Fix bug. Add example.
1.2.0 K Hoang 09/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
1.4.1 K Hoang 22/12/2020 Fix staticIP not saved. Add functions. Add complex examples. Sync with ESPAsync_WiFiManager
1.4.2 K Hoang 14/01/2021 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
1.4.3 K Hoang 23/01/2021 Fix examples' bug not saving Static IP in certain cases.
1.5.0 K Hoang 12/02/2021 Add support to new ESP32-S2
1.5.1 K Hoang 26/03/2021 Fix compiler error if setting Compiler Warnings to All. Retest with esp32 core v1.0.6
1.5.2 K Hoang 08/04/2021 Fix example misleading messages.
1.5.3 K Hoang 13/04/2021 Add dnsServer error message.
1.6.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
1.6.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1
1.7.0 K Hoang 06/05/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
1.7.1 K Hoang 08/05/2021 Fix Json bug. Fix timezoneName not displayed in Info page.
1.7.2 K Hoang 08/05/2021 Fix warnings with ESP8266 core v3.0.0
1.7.3 K Hoang 29/07/2021 Fix MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
1.7.4 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
1.7.5 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug
...
1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
*****************************************************************************************************************************/
#pragma once

View File

@ -71,8 +71,6 @@
////////////////////////////////////////////////////
#if 1
#define TZ_Africa_Abidjan ("GMT0")
#define TZ_Africa_Accra ("GMT0")
#define TZ_Africa_Addis_Ababa ("EAT-3")
@ -534,479 +532,11 @@
#define TZ_Etc_Universal ("UTC0")
#define TZ_Etc_Zulu ("UTC0")
#else
#define TZ_Africa_Abidjan PSTR("GMT0")
#define TZ_Africa_Accra PSTR("GMT0")
#define TZ_Africa_Addis_Ababa PSTR("EAT-3")
#define TZ_Africa_Algiers PSTR("CET-1")
#define TZ_Africa_Asmara PSTR("EAT-3")
#define TZ_Africa_Bamako PSTR("GMT0")
#define TZ_Africa_Bangui PSTR("WAT-1")
#define TZ_Africa_Banjul PSTR("GMT0")
#define TZ_Africa_Bissau PSTR("GMT0")
#define TZ_Africa_Blantyre PSTR("CAT-2")
#define TZ_Africa_Brazzaville PSTR("WAT-1")
#define TZ_Africa_Bujumbura PSTR("CAT-2")
#define TZ_Africa_Cairo PSTR("EET-2")
#define TZ_Africa_Casablanca PSTR("<+01>-1")
#define TZ_Africa_Ceuta PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Africa_Conakry PSTR("GMT0")
#define TZ_Africa_Dakar PSTR("GMT0")
#define TZ_Africa_Dar_es_Salaam PSTR("EAT-3")
#define TZ_Africa_Djibouti PSTR("EAT-3")
#define TZ_Africa_Douala PSTR("WAT-1")
#define TZ_Africa_El_Aaiun PSTR("<+01>-1")
#define TZ_Africa_Freetown PSTR("GMT0")
#define TZ_Africa_Gaborone PSTR("CAT-2")
#define TZ_Africa_Harare PSTR("CAT-2")
#define TZ_Africa_Johannesburg PSTR("SAST-2")
#define TZ_Africa_Juba PSTR("EAT-3")
#define TZ_Africa_Kampala PSTR("EAT-3")
#define TZ_Africa_Khartoum PSTR("CAT-2")
#define TZ_Africa_Kigali PSTR("CAT-2")
#define TZ_Africa_Kinshasa PSTR("WAT-1")
#define TZ_Africa_Lagos PSTR("WAT-1")
#define TZ_Africa_Libreville PSTR("WAT-1")
#define TZ_Africa_Lome PSTR("GMT0")
#define TZ_Africa_Luanda PSTR("WAT-1")
#define TZ_Africa_Lubumbashi PSTR("CAT-2")
#define TZ_Africa_Lusaka PSTR("CAT-2")
#define TZ_Africa_Malabo PSTR("WAT-1")
#define TZ_Africa_Maputo PSTR("CAT-2")
#define TZ_Africa_Maseru PSTR("SAST-2")
#define TZ_Africa_Mbabane PSTR("SAST-2")
#define TZ_Africa_Mogadishu PSTR("EAT-3")
#define TZ_Africa_Monrovia PSTR("GMT0")
#define TZ_Africa_Nairobi PSTR("EAT-3")
#define TZ_Africa_Ndjamena PSTR("WAT-1")
#define TZ_Africa_Niamey PSTR("WAT-1")
#define TZ_Africa_Nouakchott PSTR("GMT0")
#define TZ_Africa_Ouagadougou PSTR("GMT0")
#define TZ_Africa_PortomNovo PSTR("WAT-1")
#define TZ_Africa_Sao_Tome PSTR("GMT0")
#define TZ_Africa_Tripoli PSTR("EET-2")
#define TZ_Africa_Tunis PSTR("CET-1")
#define TZ_Africa_Windhoek PSTR("CAT-2")
#define TZ_America_Adak PSTR("HST10HDT,M3.2.0,M11.1.0")
#define TZ_America_Anchorage PSTR("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Anguilla PSTR("AST4")
#define TZ_America_Antigua PSTR("AST4")
#define TZ_America_Araguaina PSTR("<-03>3")
#define TZ_America_Argentina_Buenos_Aires PSTR("<-03>3")
#define TZ_America_Argentina_Catamarca PSTR("<-03>3")
#define TZ_America_Argentina_Cordoba PSTR("<-03>3")
#define TZ_America_Argentina_Jujuy PSTR("<-03>3")
#define TZ_America_Argentina_La_Rioja PSTR("<-03>3")
#define TZ_America_Argentina_Mendoza PSTR("<-03>3")
#define TZ_America_Argentina_Rio_Gallegos PSTR("<-03>3")
#define TZ_America_Argentina_Salta PSTR("<-03>3")
#define TZ_America_Argentina_San_Juan PSTR("<-03>3")
#define TZ_America_Argentina_San_Luis PSTR("<-03>3")
#define TZ_America_Argentina_Tucuman PSTR("<-03>3")
#define TZ_America_Argentina_Ushuaia PSTR("<-03>3")
#define TZ_America_Aruba PSTR("AST4")
#define TZ_America_Asuncion PSTR("<-04>4<-03>,M10.1.0/0,M3.4.0/0")
#define TZ_America_Atikokan PSTR("EST5")
#define TZ_America_Bahia PSTR("<-03>3")
#define TZ_America_Bahia_Banderas PSTR("CST6CDT,M4.1.0,M10.5.0")
#define TZ_America_Barbados PSTR("AST4")
#define TZ_America_Belem PSTR("<-03>3")
#define TZ_America_Belize PSTR("CST6")
#define TZ_America_BlancmSablon PSTR("AST4")
#define TZ_America_Boa_Vista PSTR("<-04>4")
#define TZ_America_Bogota PSTR("<-05>5")
#define TZ_America_Boise PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Cambridge_Bay PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Campo_Grande PSTR("<-04>4")
#define TZ_America_Cancun PSTR("EST5")
#define TZ_America_Caracas PSTR("<-04>4")
#define TZ_America_Cayenne PSTR("<-03>3")
#define TZ_America_Cayman PSTR("EST5")
#define TZ_America_Chicago PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Chihuahua PSTR("MST7MDT,M4.1.0,M10.5.0")
#define TZ_America_Costa_Rica PSTR("CST6")
#define TZ_America_Creston PSTR("MST7")
#define TZ_America_Cuiaba PSTR("<-04>4")
#define TZ_America_Curacao PSTR("AST4")
#define TZ_America_Danmarkshavn PSTR("GMT0")
#define TZ_America_Dawson PSTR("MST7")
#define TZ_America_Dawson_Creek PSTR("MST7")
#define TZ_America_Denver PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Detroit PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Dominica PSTR("AST4")
#define TZ_America_Edmonton PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Eirunepe PSTR("<-05>5")
#define TZ_America_El_Salvador PSTR("CST6")
#define TZ_America_Fortaleza PSTR("<-03>3")
#define TZ_America_Fort_Nelson PSTR("MST7")
#define TZ_America_Glace_Bay PSTR("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Godthab PSTR("<-03>3<-02>,M3.5.0/-2,M10.5.0/-1")
#define TZ_America_Goose_Bay PSTR("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Grand_Turk PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Grenada PSTR("AST4")
#define TZ_America_Guadeloupe PSTR("AST4")
#define TZ_America_Guatemala PSTR("CST6")
#define TZ_America_Guayaquil PSTR("<-05>5")
#define TZ_America_Guyana PSTR("<-04>4")
#define TZ_America_Halifax PSTR("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Havana PSTR("CST5CDT,M3.2.0/0,M11.1.0/1")
#define TZ_America_Hermosillo PSTR("MST7")
#define TZ_America_Indiana_Indianapolis PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Knox PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Marengo PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Petersburg PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Tell_City PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Vevay PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Vincennes PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Indiana_Winamac PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Inuvik PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Iqaluit PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Jamaica PSTR("EST5")
#define TZ_America_Juneau PSTR("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Kentucky_Louisville PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Kentucky_Monticello PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Kralendijk PSTR("AST4")
#define TZ_America_La_Paz PSTR("<-04>4")
#define TZ_America_Lima PSTR("<-05>5")
#define TZ_America_Los_Angeles PSTR("PST8PDT,M3.2.0,M11.1.0")
#define TZ_America_Lower_Princes PSTR("AST4")
#define TZ_America_Maceio PSTR("<-03>3")
#define TZ_America_Managua PSTR("CST6")
#define TZ_America_Manaus PSTR("<-04>4")
#define TZ_America_Marigot PSTR("AST4")
#define TZ_America_Martinique PSTR("AST4")
#define TZ_America_Matamoros PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Mazatlan PSTR("MST7MDT,M4.1.0,M10.5.0")
#define TZ_America_Menominee PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Merida PSTR("CST6CDT,M4.1.0,M10.5.0")
#define TZ_America_Metlakatla PSTR("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Mexico_City PSTR("CST6CDT,M4.1.0,M10.5.0")
#define TZ_America_Miquelon PSTR("<-03>3<-02>,M3.2.0,M11.1.0")
#define TZ_America_Moncton PSTR("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Monterrey PSTR("CST6CDT,M4.1.0,M10.5.0")
#define TZ_America_Montevideo PSTR("<-03>3")
#define TZ_America_Montreal PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Montserrat PSTR("AST4")
#define TZ_America_Nassau PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_New_York PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Nipigon PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Nome PSTR("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Noronha PSTR("<-02>2")
#define TZ_America_North_Dakota_Beulah PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_North_Dakota_Center PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_North_Dakota_New_Salem PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Ojinaga PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_America_Panama PSTR("EST5")
#define TZ_America_Pangnirtung PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Paramaribo PSTR("<-03>3")
#define TZ_America_Phoenix PSTR("MST7")
#define TZ_America_PortmaumPrince PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Port_of_Spain PSTR("AST4")
#define TZ_America_Porto_Velho PSTR("<-04>4")
#define TZ_America_Puerto_Rico PSTR("AST4")
#define TZ_America_Punta_Arenas PSTR("<-03>3")
#define TZ_America_Rainy_River PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Rankin_Inlet PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Recife PSTR("<-03>3")
#define TZ_America_Regina PSTR("CST6")
#define TZ_America_Resolute PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Rio_Branco PSTR("<-05>5")
#define TZ_America_Santarem PSTR("<-03>3")
#define TZ_America_Santiago PSTR("<-04>4<-03>,M9.1.6/24,M4.1.6/24")
#define TZ_America_Santo_Domingo PSTR("AST4")
#define TZ_America_Sao_Paulo PSTR("<-03>3")
#define TZ_America_Scoresbysund PSTR("<-01>1<+00>,M3.5.0/0,M10.5.0/1")
#define TZ_America_Sitka PSTR("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_St_Barthelemy PSTR("AST4")
#define TZ_America_St_Johns PSTR("NST3:30NDT,M3.2.0,M11.1.0")
#define TZ_America_St_Kitts PSTR("AST4")
#define TZ_America_St_Lucia PSTR("AST4")
#define TZ_America_St_Thomas PSTR("AST4")
#define TZ_America_St_Vincent PSTR("AST4")
#define TZ_America_Swift_Current PSTR("CST6")
#define TZ_America_Tegucigalpa PSTR("CST6")
#define TZ_America_Thule PSTR("AST4ADT,M3.2.0,M11.1.0")
#define TZ_America_Thunder_Bay PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Tijuana PSTR("PST8PDT,M3.2.0,M11.1.0")
#define TZ_America_Toronto PSTR("EST5EDT,M3.2.0,M11.1.0")
#define TZ_America_Tortola PSTR("AST4")
#define TZ_America_Vancouver PSTR("PST8PDT,M3.2.0,M11.1.0")
#define TZ_America_Whitehorse PSTR("MST7")
#define TZ_America_Winnipeg PSTR("CST6CDT,M3.2.0,M11.1.0")
#define TZ_America_Yakutat PSTR("AKST9AKDT,M3.2.0,M11.1.0")
#define TZ_America_Yellowknife PSTR("MST7MDT,M3.2.0,M11.1.0")
#define TZ_Antarctica_Casey PSTR("<+11>-11")
#define TZ_Antarctica_Davis PSTR("<+07>-7")
#define TZ_Antarctica_DumontDUrville PSTR("<+10>-10")
#define TZ_Antarctica_Macquarie PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Antarctica_Mawson PSTR("<+05>-5")
#define TZ_Antarctica_McMurdo PSTR("NZST-12NZDT,M9.5.0,M4.1.0/3")
#define TZ_Antarctica_Palmer PSTR("<-03>3")
#define TZ_Antarctica_Rothera PSTR("<-03>3")
#define TZ_Antarctica_Syowa PSTR("<+03>-3")
#define TZ_Antarctica_Troll PSTR("<+00>0<+02>-2,M3.5.0/1,M10.5.0/3")
#define TZ_Antarctica_Vostok PSTR("<+06>-6")
#define TZ_Arctic_Longyearbyen PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Asia_Aden PSTR("<+03>-3")
#define TZ_Asia_Almaty PSTR("<+06>-6")
#define TZ_Asia_Amman PSTR("EET-2EEST,M3.5.4/24,M10.5.5/1")
#define TZ_Asia_Anadyr PSTR("<+12>-12")
#define TZ_Asia_Aqtau PSTR("<+05>-5")
#define TZ_Asia_Aqtobe PSTR("<+05>-5")
#define TZ_Asia_Ashgabat PSTR("<+05>-5")
#define TZ_Asia_Atyrau PSTR("<+05>-5")
#define TZ_Asia_Baghdad PSTR("<+03>-3")
#define TZ_Asia_Bahrain PSTR("<+03>-3")
#define TZ_Asia_Baku PSTR("<+04>-4")
#define TZ_Asia_Bangkok PSTR("<+07>-7")
#define TZ_Asia_Barnaul PSTR("<+07>-7")
#define TZ_Asia_Beirut PSTR("EET-2EEST,M3.5.0/0,M10.5.0/0")
#define TZ_Asia_Bishkek PSTR("<+06>-6")
#define TZ_Asia_Brunei PSTR("<+08>-8")
#define TZ_Asia_Chita PSTR("<+09>-9")
#define TZ_Asia_Choibalsan PSTR("<+08>-8")
#define TZ_Asia_Colombo PSTR("<+0530>-5:30")
#define TZ_Asia_Damascus PSTR("EET-2EEST,M3.5.5/0,M10.5.5/0")
#define TZ_Asia_Dhaka PSTR("<+06>-6")
#define TZ_Asia_Dili PSTR("<+09>-9")
#define TZ_Asia_Dubai PSTR("<+04>-4")
#define TZ_Asia_Dushanbe PSTR("<+05>-5")
#define TZ_Asia_Famagusta PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Asia_Gaza PSTR("EET-2EEST,M3.4.4/48,M10.4.4/49")
#define TZ_Asia_Hebron PSTR("EET-2EEST,M3.4.4/48,M10.4.4/49")
#define TZ_Asia_Ho_Chi_Minh PSTR("<+07>-7")
#define TZ_Asia_Hong_Kong PSTR("HKT-8")
#define TZ_Asia_Hovd PSTR("<+07>-7")
#define TZ_Asia_Irkutsk PSTR("<+08>-8")
#define TZ_Asia_Jakarta PSTR("WIB-7")
#define TZ_Asia_Jayapura PSTR("WIT-9")
#define TZ_Asia_Jerusalem PSTR("IST-2IDT,M3.4.4/26,M10.5.0")
#define TZ_Asia_Kabul PSTR("<+0430>-4:30")
#define TZ_Asia_Kamchatka PSTR("<+12>-12")
#define TZ_Asia_Karachi PSTR("PKT-5")
#define TZ_Asia_Kathmandu PSTR("<+0545>-5:45")
#define TZ_Asia_Khandyga PSTR("<+09>-9")
#define TZ_Asia_Kolkata PSTR("IST-5:30")
#define TZ_Asia_Krasnoyarsk PSTR("<+07>-7")
#define TZ_Asia_Kuala_Lumpur PSTR("<+08>-8")
#define TZ_Asia_Kuching PSTR("<+08>-8")
#define TZ_Asia_Kuwait PSTR("<+03>-3")
#define TZ_Asia_Macau PSTR("CST-8")
#define TZ_Asia_Magadan PSTR("<+11>-11")
#define TZ_Asia_Makassar PSTR("WITA-8")
#define TZ_Asia_Manila PSTR("PST-8")
#define TZ_Asia_Muscat PSTR("<+04>-4")
#define TZ_Asia_Nicosia PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Asia_Novokuznetsk PSTR("<+07>-7")
#define TZ_Asia_Novosibirsk PSTR("<+07>-7")
#define TZ_Asia_Omsk PSTR("<+06>-6")
#define TZ_Asia_Oral PSTR("<+05>-5")
#define TZ_Asia_Phnom_Penh PSTR("<+07>-7")
#define TZ_Asia_Pontianak PSTR("WIB-7")
#define TZ_Asia_Pyongyang PSTR("KST-9")
#define TZ_Asia_Qatar PSTR("<+03>-3")
#define TZ_Asia_Qyzylorda PSTR("<+05>-5")
#define TZ_Asia_Riyadh PSTR("<+03>-3")
#define TZ_Asia_Sakhalin PSTR("<+11>-11")
#define TZ_Asia_Samarkand PSTR("<+05>-5")
#define TZ_Asia_Seoul PSTR("KST-9")
#define TZ_Asia_Shanghai PSTR("CST-8")
#define TZ_Asia_Singapore PSTR("<+08>-8")
#define TZ_Asia_Srednekolymsk PSTR("<+11>-11")
#define TZ_Asia_Taipei PSTR("CST-8")
#define TZ_Asia_Tashkent PSTR("<+05>-5")
#define TZ_Asia_Tbilisi PSTR("<+04>-4")
#define TZ_Asia_Tehran PSTR("<+0330>-3:30<+0430>,J79/24,J263/24")
#define TZ_Asia_Thimphu PSTR("<+06>-6")
#define TZ_Asia_Tokyo PSTR("JST-9")
#define TZ_Asia_Tomsk PSTR("<+07>-7")
#define TZ_Asia_Ulaanbaatar PSTR("<+08>-8")
#define TZ_Asia_Urumqi PSTR("<+06>-6")
#define TZ_Asia_UstmNera PSTR("<+10>-10")
#define TZ_Asia_Vientiane PSTR("<+07>-7")
#define TZ_Asia_Vladivostok PSTR("<+10>-10")
#define TZ_Asia_Yakutsk PSTR("<+09>-9")
#define TZ_Asia_Yangon PSTR("<+0630>-6:30")
#define TZ_Asia_Yekaterinburg PSTR("<+05>-5")
#define TZ_Asia_Yerevan PSTR("<+04>-4")
#define TZ_Atlantic_Azores PSTR("<-01>1<+00>,M3.5.0/0,M10.5.0/1")
#define TZ_Atlantic_Bermuda PSTR("AST4ADT,M3.2.0,M11.1.0")
#define TZ_Atlantic_Canary PSTR("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Atlantic_Cape_Verde PSTR("<-01>1")
#define TZ_Atlantic_Faroe PSTR("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Atlantic_Madeira PSTR("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Atlantic_Reykjavik PSTR("GMT0")
#define TZ_Atlantic_South_Georgia PSTR("<-02>2")
#define TZ_Atlantic_Stanley PSTR("<-03>3")
#define TZ_Atlantic_St_Helena PSTR("GMT0")
#define TZ_Australia_Adelaide PSTR("ACST-9:30ACDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Brisbane PSTR("AEST-10")
#define TZ_Australia_Broken_Hill PSTR("ACST-9:30ACDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Currie PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Darwin PSTR("ACST-9:30")
#define TZ_Australia_Eucla PSTR("<+0845>-8:45")
#define TZ_Australia_Hobart PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Lindeman PSTR("AEST-10")
#define TZ_Australia_Lord_Howe PSTR("<+1030>-10:30<+11>-11,M10.1.0,M4.1.0")
#define TZ_Australia_Melbourne PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Australia_Perth PSTR("AWST-8")
#define TZ_Australia_Sydney PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3")
#define TZ_Europe_Amsterdam PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Andorra PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Astrakhan PSTR("<+04>-4")
#define TZ_Europe_Athens PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Belgrade PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Berlin PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Bratislava PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Brussels PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Bucharest PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Budapest PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Busingen PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Chisinau PSTR("EET-2EEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Copenhagen PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Dublin PSTR("IST-1GMT0,M10.5.0,M3.5.0/1")
#define TZ_Europe_Gibraltar PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Guernsey PSTR("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Helsinki PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Isle_of_Man PSTR("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Istanbul PSTR("<+03>-3")
#define TZ_Europe_Jersey PSTR("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Kaliningrad PSTR("EET-2")
#define TZ_Europe_Kiev PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Kirov PSTR("<+03>-3")
#define TZ_Europe_Lisbon PSTR("WET0WEST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Ljubljana PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_London PSTR("GMT0BST,M3.5.0/1,M10.5.0")
#define TZ_Europe_Luxembourg PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Madrid PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Malta PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Mariehamn PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Minsk PSTR("<+03>-3")
#define TZ_Europe_Monaco PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Moscow PSTR("MSK-3")
#define TZ_Europe_Oslo PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Paris PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Podgorica PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Prague PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Riga PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Rome PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Samara PSTR("<+04>-4")
#define TZ_Europe_San_Marino PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Sarajevo PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Saratov PSTR("<+04>-4")
#define TZ_Europe_Simferopol PSTR("MSK-3")
#define TZ_Europe_Skopje PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Sofia PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Stockholm PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Tallinn PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Tirane PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Ulyanovsk PSTR("<+04>-4")
#define TZ_Europe_Uzhgorod PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Vaduz PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Vatican PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Vienna PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Vilnius PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Volgograd PSTR("<+04>-4")
#define TZ_Europe_Warsaw PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Zagreb PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Europe_Zaporozhye PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4")
#define TZ_Europe_Zurich PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
#define TZ_Indian_Antananarivo PSTR("EAT-3")
#define TZ_Indian_Chagos PSTR("<+06>-6")
#define TZ_Indian_Christmas PSTR("<+07>-7")
#define TZ_Indian_Cocos PSTR("<+0630>-6:30")
#define TZ_Indian_Comoro PSTR("EAT-3")
#define TZ_Indian_Kerguelen PSTR("<+05>-5")
#define TZ_Indian_Mahe PSTR("<+04>-4")
#define TZ_Indian_Maldives PSTR("<+05>-5")
#define TZ_Indian_Mauritius PSTR("<+04>-4")
#define TZ_Indian_Mayotte PSTR("EAT-3")
#define TZ_Indian_Reunion PSTR("<+04>-4")
#define TZ_Pacific_Apia PSTR("<+13>-13<+14>,M9.5.0/3,M4.1.0/4")
#define TZ_Pacific_Auckland PSTR("NZST-12NZDT,M9.5.0,M4.1.0/3")
#define TZ_Pacific_Bougainville PSTR("<+11>-11")
#define TZ_Pacific_Chatham PSTR("<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45")
#define TZ_Pacific_Chuuk PSTR("<+10>-10")
#define TZ_Pacific_Easter PSTR("<-06>6<-05>,M9.1.6/22,M4.1.6/22")
#define TZ_Pacific_Efate PSTR("<+11>-11")
#define TZ_Pacific_Enderbury PSTR("<+13>-13")
#define TZ_Pacific_Fakaofo PSTR("<+13>-13")
#define TZ_Pacific_Fiji PSTR("<+12>-12<+13>,M11.2.0,M1.2.3/99")
#define TZ_Pacific_Funafuti PSTR("<+12>-12")
#define TZ_Pacific_Galapagos PSTR("<-06>6")
#define TZ_Pacific_Gambier PSTR("<-09>9")
#define TZ_Pacific_Guadalcanal PSTR("<+11>-11")
#define TZ_Pacific_Guam PSTR("ChST-10")
#define TZ_Pacific_Honolulu PSTR("HST10")
#define TZ_Pacific_Kiritimati PSTR("<+14>-14")
#define TZ_Pacific_Kosrae PSTR("<+11>-11")
#define TZ_Pacific_Kwajalein PSTR("<+12>-12")
#define TZ_Pacific_Majuro PSTR("<+12>-12")
#define TZ_Pacific_Marquesas PSTR("<-0930>9:30")
#define TZ_Pacific_Midway PSTR("SST11")
#define TZ_Pacific_Nauru PSTR("<+12>-12")
#define TZ_Pacific_Niue PSTR("<-11>11")
#define TZ_Pacific_Norfolk PSTR("<+11>-11<+12>,M10.1.0,M4.1.0/3")
#define TZ_Pacific_Noumea PSTR("<+11>-11")
#define TZ_Pacific_Pago_Pago PSTR("SST11")
#define TZ_Pacific_Palau PSTR("<+09>-9")
#define TZ_Pacific_Pitcairn PSTR("<-08>8")
#define TZ_Pacific_Pohnpei PSTR("<+11>-11")
#define TZ_Pacific_Port_Moresby PSTR("<+10>-10")
#define TZ_Pacific_Rarotonga PSTR("<-10>10")
#define TZ_Pacific_Saipan PSTR("ChST-10")
#define TZ_Pacific_Tahiti PSTR("<-10>10")
#define TZ_Pacific_Tarawa PSTR("<+12>-12")
#define TZ_Pacific_Tongatapu PSTR("<+13>-13")
#define TZ_Pacific_Wake PSTR("<+12>-12")
#define TZ_Pacific_Wallis PSTR("<+12>-12")
#define TZ_Etc_GMT PSTR("GMT0")
#define TZ_Etc_GMTm0 PSTR("GMT0")
#define TZ_Etc_GMTm1 PSTR("<+01>-1")
#define TZ_Etc_GMTm2 PSTR("<+02>-2")
#define TZ_Etc_GMTm3 PSTR("<+03>-3")
#define TZ_Etc_GMTm4 PSTR("<+04>-4")
#define TZ_Etc_GMTm5 PSTR("<+05>-5")
#define TZ_Etc_GMTm6 PSTR("<+06>-6")
#define TZ_Etc_GMTm7 PSTR("<+07>-7")
#define TZ_Etc_GMTm8 PSTR("<+08>-8")
#define TZ_Etc_GMTm9 PSTR("<+09>-9")
#define TZ_Etc_GMTm10 PSTR("<+10>-10")
#define TZ_Etc_GMTm11 PSTR("<+11>-11")
#define TZ_Etc_GMTm12 PSTR("<+12>-12")
#define TZ_Etc_GMTm13 PSTR("<+13>-13")
#define TZ_Etc_GMTm14 PSTR("<+14>-14")
#define TZ_Etc_GMT0 PSTR("GMT0")
#define TZ_Etc_GMTp0 PSTR("GMT0")
#define TZ_Etc_GMTp1 PSTR("<-01>1")
#define TZ_Etc_GMTp2 PSTR("<-02>2")
#define TZ_Etc_GMTp3 PSTR("<-03>3")
#define TZ_Etc_GMTp4 PSTR("<-04>4")
#define TZ_Etc_GMTp5 PSTR("<-05>5")
#define TZ_Etc_GMTp6 PSTR("<-06>6")
#define TZ_Etc_GMTp7 PSTR("<-07>7")
#define TZ_Etc_GMTp8 PSTR("<-08>8")
#define TZ_Etc_GMTp9 PSTR("<-09>9")
#define TZ_Etc_GMTp10 PSTR("<-10>10")
#define TZ_Etc_GMTp11 PSTR("<-11>11")
#define TZ_Etc_GMTp12 PSTR("<-12>12")
#define TZ_Etc_UCT PSTR("UTC0")
#define TZ_Etc_UTC PSTR("UTC0")
#define TZ_Etc_Greenwich PSTR("GMT0")
#define TZ_Etc_Universal PSTR("UTC0")
#define TZ_Etc_Zulu PSTR("UTC0")
#endif
////////////////////////////////////////////////////////////
#define TIMEZONE_MAX_LEN 50
#if 1
const char TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ =
static const char TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ =
{
#if USING_AFRICA
"Africa/Abidjan", //PSTR("GMT0")
@ -1503,7 +1033,7 @@ const char TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ =
////////////////////////////////////////////////////////////
const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ =
static const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ =
{
#if USING_AFRICA
TZ_Africa_Abidjan, //PSTR("GMT0")
@ -1999,152 +1529,4 @@ const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ =
#endif
};
#else
const char TZ_NAME[][TIMEZONE_MAX_LEN] =
{
"Pacific/Pago_Pago",
"America/Adak",
"Pacific/Honolulu",
"Pacific/Marquesas",
"Pacific/Gambier",
"America/Anchorage",
"America/Los_Angeles",
"Pacific/Pitcairn",
"America/Phoenix",
"America/Denver",
"America/Guatemala",
"America/Chicago",
"Pacific/Easter",
"America/Bogota",
"America/New_York",
"America/Caracas",
"America/Halifax",
"America/Santo_Domingo",
"America/Santiago",
"America/St_Johns",
"America/Godthab",
"America/Argentina/Buenos_Aires",
"America/Montevideo",
"Etc/GMT+2",
"Atlantic/Azores",
"Atlantic/Cape_Verde",
"Etc/UTC",
"Europe/London",
"Europe/Berlin",
"Africa/Lagos",
"Africa/Windhoek",
"Asia/Beirut",
"Africa/Johannesburg",
"Asia/Baghdad",
"Europe/Moscow",
"Asia/Tehran",
"Asia/Dubai",
"Asia/Baku",
"Asia/Kabul",
"Asia/Yekaterinburg",
"Asia/Karachi",
"Asia/Kolkata",
"Asia/Kathmandu",
"Asia/Dhaka",
"Asia/Omsk",
"Asia/Krasnoyarsk",
"Asia/Jakarta",
"Asia/Shanghai",
"Asia/Irkutsk",
"Australia/Eucla",
"Asia/Yakutsk",
"Asia/Tokyo",
"Australia/Darwin",
"Australia/Adelaide",
"Australia/Brisbane",
"Asia/Vladivostok",
"Australia/Sydney",
"Australia/Lord_Howe",
"Asia/Kamchatka",
"Pacific/Noumea",
"Pacific/Norfolk",
"Pacific/Auckland",
"Pacific/Tarawa",
"Pacific/Chatham",
"Pacific/Tongatapu",
"Pacific/Apia",
"Pacific/Kiritimati",
};
////////////////////////////////////////////////////////////
const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] =
{
TZ_Pacific_Pago_Pago, //PSTR("SST11")
TZ_America_Adak, //PSTR("HST10HDT,M3.2.0,M11.1.0")
TZ_Pacific_Honolulu, //PSTR("HST10")
TZ_Pacific_Marquesas, //PSTR("<-0930>9:30")
TZ_Pacific_Gambier, //PSTR("<-09>9")
TZ_America_Anchorage, //PSTR("AKST9AKDT,M3.2.0,M11.1.0")
TZ_America_Los_Angeles, //"PST8PDT,M3.2.0,M11.1.0", //"America/Los_Angeles",
TZ_Pacific_Pitcairn, //PSTR("<-08>8")
TZ_America_Phoenix, //PSTR("MST7")
TZ_America_Denver, //"MST7MDT,M3.2.0,M11.1.0", //"America/Denver",
TZ_America_Guatemala, //PSTR("CST6")
TZ_America_Chicago, //"CST6CDT,M3.2.0,M11.1.0", //"America/Chicago",
TZ_Pacific_Easter, //PSTR("<-06>6<-05>,M9.1.6/22,M4.1.6/22")
TZ_America_Bogota, //PSTR("<-05>5")
TZ_America_New_York, //"EST5EDT,M3.2.0,M11.1.0", //"America/New_York",
TZ_America_Caracas, //PSTR("<-04>4")
TZ_America_Halifax, //"AST4ADT,M3.2.0,M11.1.0", //"America/Halifax",
TZ_America_Santo_Domingo, //PSTR("AST4")
TZ_America_Santiago, //"<-04>4<-03>,M9.1.6/24,M4.1.6/24", //"America/Santiago",
TZ_America_St_Johns, //PSTR("NST3:30NDT,M3.2.0,M11.1.0")
TZ_America_Godthab, //"<-03>3<-02>,M3.5.0/-2,M10.5.0/-1", //"America/Godthab",
TZ_America_Argentina_Buenos_Aires, //PSTR("<-03>3")
TZ_America_Montevideo, //"<-03>3", //"America/Montevideo",
TZ_Etc_GMTp2, //PSTR("<-02>2")
TZ_Atlantic_Azores, //PSTR("<-01>1<+00>,M3.5.0/0,M10.5.0/1")
TZ_Atlantic_Cape_Verde, //PSTR("<-01>1")
TZ_Etc_UTC, //PSTR("UTC0")
TZ_Europe_London, //PSTR("GMT0BST,M3.5.0/1,M10.5.0")
TZ_Europe_Berlin, //PSTR("CET-1CEST,M3.5.0,M10.5.0/3")
TZ_Africa_Lagos, //PSTR("WAT-1")
TZ_Africa_Windhoek, //PSTR("CAT-2")
TZ_Asia_Beirut, //"EET-2EEST,M3.5.0/0,M10.5.0/0" //"Asia/Beirut",
TZ_Africa_Johannesburg, //"SAST-2", //"Africa/Johannesburg",
TZ_Asia_Baghdad, //"<+03>-3", //"Asia/Baghdad",
TZ_Europe_Moscow, //PSTR("MSK-3")
TZ_Asia_Tehran, //PSTR("<+0330>-3:30<+0430>,J79/24,J263/24")
TZ_Asia_Dubai, //"<+04>-4", //"Asia/Dubai",
TZ_Asia_Baku, //PSTR("<+04>-4")
TZ_Asia_Kabul, //PSTR("<+0430>-4:30")
TZ_Asia_Yekaterinburg, //PSTR("<+05>-5")
TZ_Asia_Karachi, //PSTR("PKT-5")
TZ_Asia_Kolkata, //PSTR("IST-5:30")
TZ_Asia_Kathmandu, //PSTR("<+0545>-5:45")
TZ_Asia_Dhaka, //"<+06>-6", //"Asia/Dhaka",
TZ_Asia_Omsk, //PSTR("<+06>-6")
TZ_Asia_Krasnoyarsk, //PSTR("<+07>-7")
TZ_Asia_Jakarta, //"WIB-7", //"Asia/Jakarta",
TZ_Asia_Shanghai, //"CST-8", //"Asia/Shanghai",
TZ_Asia_Irkutsk, //PSTR("<+08>-8")
TZ_Australia_Eucla, //PSTR("<+0845>-8:45")
TZ_Asia_Yakutsk, //PSTR("<+09>-9")
TZ_Asia_Tokyo, //"JST-9", //"Asia/Tokyo",
TZ_Australia_Darwin, //PSTR("ACST-9:30")
TZ_Australia_Adelaide, //PSTR("ACST-9:30ACDT,M10.1.0,M4.1.0/3")
TZ_Australia_Brisbane, //"AEST-10", //"Australia/Brisbane",
TZ_Asia_Vladivostok, //PSTR("<+10>-10")
TZ_Australia_Sydney, //PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3")
TZ_Australia_Lord_Howe, //PSTR("<+1030>-10:30<+11>-11,M10.1.0,M4.1.0")
TZ_Asia_Kamchatka, //PSTR("<+12>-12")
TZ_Pacific_Noumea, //"<+11>-11", //"Pacific/Noumea",
TZ_Pacific_Norfolk, //PSTR("<+11>-11<+12>,M10.1.0,M4.1.0/3")
TZ_Pacific_Auckland, //"NZST-12NZDT,M9.5.0,M4.1.0/3", //"Pacific/Auckland",
TZ_Pacific_Tarawa, //"<+12>-12", //"Pacific/Tarawa",
TZ_Pacific_Chatham, //PSTR("<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45")
TZ_Pacific_Tongatapu, //PSTR("<+13>-13")
TZ_Pacific_Apia, //PSTR("<+13>-13<+14>,M9.5.0/3,M4.1.0/4")
TZ_Pacific_Kiritimati, //PSTR("<+14>-14")
};
#endif
#endif // TZDB_H

View File

@ -234,9 +234,7 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
useWire->beginTransmission(devAddr);
useWire->send(regAddr);
useWire->endTransmission();
useWire->beginTransmission(devAddr);
useWire->requestFrom((uint8_t)devAddr, (uint8_t)min((int)length - k, I2CDEVLIB_WIRE_BUFFER_LENGTH));
for (; useWire->available() && (timeout == 0 || millis() - t1 < timeout); count++) {
data[count] = useWire->receive();
#ifdef I2CDEV_SERIAL_DEBUG
@ -244,8 +242,6 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
if (count + 1 < length) Serial.print(" ");
#endif
}
useWire->endTransmission();
}
#elif (ARDUINO == 100)
// Arduino v1.0.0, Wire library
@ -258,9 +254,7 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
useWire->beginTransmission(devAddr);
useWire->write(regAddr);
useWire->endTransmission();
useWire->beginTransmission(devAddr);
useWire->requestFrom((uint8_t)devAddr, (uint8_t)min((int)length - k, I2CDEVLIB_WIRE_BUFFER_LENGTH));
for (; useWire->available() && (timeout == 0 || millis() - t1 < timeout); count++) {
data[count] = useWire->read();
#ifdef I2CDEV_SERIAL_DEBUG
@ -268,8 +262,6 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
if (count + 1 < length) Serial.print(" ");
#endif
}
useWire->endTransmission();
}
#elif (ARDUINO > 100)
// Arduino v1.0.1+, Wire library
@ -282,10 +274,7 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
useWire->beginTransmission(devAddr);
useWire->write(regAddr);
useWire->endTransmission();
// See: https://github.com/espressif/arduino-esp32/issues/6674
// useWire->beginTransmission(devAddr);
useWire->requestFrom((uint8_t)devAddr, (uint8_t)min((int)length - k, I2CDEVLIB_WIRE_BUFFER_LENGTH));
for (; useWire->available() && (timeout == 0 || millis() - t1 < timeout); count++) {
data[count] = useWire->read();
#ifdef I2CDEV_SERIAL_DEBUG
@ -357,7 +346,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
useWire->beginTransmission(devAddr);
useWire->send(regAddr);
useWire->endTransmission();
useWire->beginTransmission(devAddr);
useWire->requestFrom(devAddr, (uint8_t)(length * 2)); // length=words, this wants bytes
bool msb = true; // starts with MSB, then LSB
@ -376,8 +364,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
}
msb = !msb;
}
useWire->endTransmission();
}
#elif (ARDUINO == 100)
// Arduino v1.0.0, Wire library
@ -390,7 +376,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
useWire->beginTransmission(devAddr);
useWire->write(regAddr);
useWire->endTransmission();
useWire->beginTransmission(devAddr);
useWire->requestFrom(devAddr, (uint8_t)(length * 2)); // length=words, this wants bytes
bool msb = true; // starts with MSB, then LSB
@ -409,8 +394,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
}
msb = !msb;
}
useWire->endTransmission();
}
#elif (ARDUINO > 100)
// Arduino v1.0.1+, Wire library
@ -423,7 +406,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
useWire->beginTransmission(devAddr);
useWire->write(regAddr);
useWire->endTransmission();
useWire->beginTransmission(devAddr);
useWire->requestFrom(devAddr, (uint8_t)(length * 2)); // length=words, this wants bytes
bool msb = true; // starts with MSB, then LSB
@ -442,8 +424,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
}
msb = !msb;
}
useWire->endTransmission();
}
#endif
@ -1486,4 +1466,4 @@ uint16_t I2Cdev::readTimeout = I2CDEV_DEFAULT_READ_TIMEOUT;
return rxBufferLength - rxBufferIndex;
}
#endif
#endif

View File

@ -308,4 +308,4 @@ class I2Cdev {
#endif // I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE
#endif /* _I2CDEV_H_ */
#endif /* _I2CDEV_H_ */

View File

@ -16,172 +16,232 @@ include_dir = lib
upload_speed = 921600
monitor_speed = 115200
platform = espressif8266 @ 4.0.1
platform32 = espressif32 @ 5.2.0
framework = arduino
board = d1_mini
build_unflags =
build_flags =
-Wl,-Map,output.map
-D BAUD=${common_env_data.monitor_speed}
-D ACTIVATE_OTA
#-D DEBUG_ESP_HTTP_CLIENT
#-D DEBUG_ESP_HTTP_SERVER
#-D DEBUG_ESP_PORT=Serial
#-D DEBUG_ESP_WIFI
#-D DEBUG_ESP_SSL
#-D DEBUG_ESP_CORE
-DBAUD=${common_env_data.monitor_speed}
#-D SKIP_SLEEPMODE
-D USE_LITTLEFS=true
-D EMBED_HTML # If this is not used the html files needs to be on the file system (can be uploaded)
-D USER_SSID=\""\"" # =\""myssid\""
-D USER_SSID_PWD=\""\"" # =\""mypwd\""
-D CFG_APPVER="\"1.1.1\""
#-D CFG_GITREV=\""beta-4\""
!python script/git_rev.py
lib_deps = # Switched to forks for better version control.
#-D FORCE_GRAVITY_MODE
#-D DOUBLERESETDETECTOR_DEBUG=true
-DACTIVATE_OTA
-DCFG_DISABLE_LOGGING # Turn off verbose/notice logging to reduce size and dont overload uart (applies to LOG_LEVEL6)
-DGYRO_DISABLE_LOGGING
-DCALC_DISABLE_LOGGING
-DHELPER_DISABLE_LOGGING
-DPUSH_DISABLE_LOGGING
-DTSEN_DISABLE_LOGGING
-DWIFI_DISABLE_LOGGING
-DWEB_DISABLE_LOGGING
-DMAIN_DISABLE_LOGGING
-DUSE_LITTLEFS=true
-DUSER_SSID=\""\"" # =\""myssid\""
-DUSER_SSID_PWD=\""\"" # =\""mypwd\""
-DCFG_APPVER="\"1.2.0\""
-DCFG_GITREV=\""beta-1\""
#!python script/git_rev.py
lib_deps =
# Using local copy of these libraries
#https://github.com/mp-se/i2cdevlib.git#<document>
#https://github.com/mp-se/OneWire # Using this version; https://github.com/arendst/Tasmota/tree/development/lib/lib_basic/OneWire-Stickbreaker
#https://github.com/mp-se/Arduino-Temperature-Control-Library
#https://github.com/khoih-prog/ESP_WiFiManager
#https://github.com/khoih-prog/ESP_DoubleResetDetector
https://github.com/mp-se/tinyexpr # https://github.com/codeplea/tinyexpr
https://github.com/mp-se/incbin # https://github.com/graphitemaster/incbin
https://github.com/mp-se/Arduino-Log#1.1.1 # https://github.com/thijse/Arduino-Log
https://github.com/mp-se/ArduinoJson#v6.18.5 # https://github.com/bblanchon/ArduinoJson
https://github.com/mp-se/arduinoCurveFitting#v1.0.6 # https://github.com/Rotario/arduinoCurveFitting
https://github.com/mp-se/arduino-mqtt#v2.5.0 # https://github.com/256dpi/arduino-mqtt
[env:gravity-debug]
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
framework = ${common_env_data.framework}
platform = ${common_env_data.platform}
# https://github.com/mp-se/i2cdevlib.git#<document>
# https://github.com/mp-se/OneWire
# https://github.com/mp-se/Arduino-Temperature-Control-Library
# https://github.com/khoih-prog/ESP_WiFiManager
# https://github.com/khoih-prog/ESP_DoubleResetDetector
https://github.com/mp-se/tinyexpr # https://github.com/codeplea/tinyexpr
https://github.com/mp-se/Arduino-Log#1.1.1 # https://github.com/thijse/Arduino-Log
https://github.com/mp-se/ArduinoJson#v6.18.5 # https://github.com/bblanchon/ArduinoJson
https://github.com/mp-se/arduinoCurveFitting#v1.0.6 # https://github.com/Rotario/arduinoCurveFitting
https://github.com/mp-se/arduino-mqtt#v2.5.0 # https://github.com/256dpi/arduino-mqtt
lib_deps32 =
https://github.com/mp-se/NimBLE-Arduino#1.3.8 # https://github.com/h2zero/NimBLE-Arduino
extra_scripts =
script/copy_html.py
script/copy_firmware.py
script/create_versionjson.py
build_unflags =
${common_env_data.build_unflags}
build_flags =
${common_env_data.build_flags}
-D PIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
#-D SKIP_SLEEPMODE
#-D DOUBLERESETDETECTOR_DEBUG=true
#-D FORCE_GRAVITY_MODE # used to debug gravity mode
-D COLLECT_PERFDATA # This option will collect runtime data for a few defined methods to measure time, dumped to serial and/or influxdb
-D LOG_LEVEL=6 # Maximum log level for the debug build.
-D CFG_DISABLE_LOGGING # Turn off verbose/notice logging to reduce size and dont overload uart.
-D GYRO_DISABLE_LOGGING
-D CALC_DISABLE_LOGGING
-D HELPER_DISABLE_LOGGING
-D PUSH_DISABLE_LOGGING
-D TSEN_DISABLE_LOGGING
-D WIFI_DISABLE_LOGGING
-D WEB_DISABLE_LOGGING
-D MAIN_DISABLE_LOGGING
lib_deps =
${common_env_data.lib_deps}
board = ${common_env_data.board}
#build_type = debug
build_type = release
board_build.filesystem = littlefs
monitor_filters = esp8266_exception_decoder
; [env:gravity-debug]
; upload_speed = ${common_env_data.upload_speed}
; monitor_speed = ${common_env_data.monitor_speed}
; framework = ${common_env_data.framework}
; platform = ${common_env_data.platform}
; extra_scripts = ${common_env_data.extra_scripts}
; build_unflags = ${common_env_data.build_unflags}
; build_flags =
; ${common_env_data.build_flags}
; #-D DEBUG_ESP_HTTP_CLIENT
; #-D DEBUG_ESP_HTTP_SERVER
; #-D DEBUG_ESP_PORT=Serial
; #-D DEBUG_ESP_WIFI
; #-D DEBUG_ESP_SSL
; #-D DEBUG_ESP_CORE
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
; -DCOLLECT_PERFDATA # Collect runtime data for a few defined methods to measure time, dumped to serial and/or influxdb
; -DLOG_LEVEL=6
; lib_deps =
; https://github.com/mp-se/incbin # https://github.com/graphitemaster/incbin
; ${common_env_data.lib_deps}
; board = ${common_env_data.board}
; build_type = release
; board_build.filesystem = littlefs
; monitor_filters = esp8266_exception_decoder
[env:gravity-release]
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
framework = ${common_env_data.framework}
platform = ${common_env_data.platform}
extra_scripts =
script/copy_html.py
script/copy_firmware.py
script/create_versionjson.py
extra_scripts = ${common_env_data.extra_scripts}
build_unflags = ${common_env_data.build_unflags}
build_flags =
${common_env_data.build_flags}
${common_env_data.build_flags}
-D LOG_LEVEL=4
lib_deps =
${common_env_data.lib_deps}
board = ${common_env_data.board}
build_type = release
board_build.filesystem = littlefs
[env:gravity-perf]
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
framework = ${common_env_data.framework}
platform = ${common_env_data.platform}
extra_scripts =
script/copy_html.py
script/copy_firmware.py
script/create_versionjson.py
build_unflags = ${common_env_data.build_unflags}
build_flags =
${common_env_data.build_flags}
-D COLLECT_PERFDATA
-D LOG_LEVEL=5
lib_deps =
https://github.com/mp-se/incbin # https://github.com/graphitemaster/incbin
${common_env_data.lib_deps}
board = ${common_env_data.board}
build_type = release
board_build.filesystem = littlefs
[env:gravity32-release]
framework = arduino
platform = espressif32 @ 5.0.0
framework = ${common_env_data.framework}
platform = ${common_env_data.platform32}
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
extra_scripts =
script/copy_html.py
script/copy_firmware.py
script/create_versionjson.py
extra_scripts = ${common_env_data.extra_scripts}
build_unflags =
${common_env_data.build_unflags}
build_flags =
-Wl,-Map,output.map
#-DCORE_DEBUG_LEVEL=0
${common_env_data.build_flags}
#-D COLLECT_PERFDATA
-D LOG_LEVEL=5
-D CFG_DISABLE_LOGGING # Turn off verbose/notice logging to reduce size and dont overload uart (applies to LOG_LEVEL6)
-D GYRO_DISABLE_LOGGING
-D CALC_DISABLE_LOGGING
-D HELPER_DISABLE_LOGGING
-D PUSH_DISABLE_LOGGING
-D TSEN_DISABLE_LOGGING
-D WIFI_DISABLE_LOGGING
-D WEB_DISABLE_LOGGING
-D MAIN_DISABLE_LOGGING
lib_deps =
${common_env_data.lib_deps}
https://github.com/mp-se/NimBLE-Arduino#1.3.8 # https://github.com/h2zero/NimBLE-Arduino
${common_env_data.lib_deps32}
lib_ignore =
board = featheresp32
board = wemos_d1_mini32
build_type = release
board_build.partitions = part32.csv
board_build.filesystem = littlefs
monitor_filters = esp32_exception_decoder
board_build.embed_txtfiles =
html/calibration.min.htm
html/config.min.htm
html/firmware.min.htm
html/format.min.htm
html/about.min.htm
html/index.min.htm
html/test.min.htm
[env:gravity32-perf]
framework = arduino
platform = espressif32 @ 5.0.0
[env:gravity32c3-release]
framework = ${common_env_data.framework}
platform = ${common_env_data.platform32}
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
extra_scripts =
script/copy_html.py
script/copy_firmware.py
script/create_versionjson.py
extra_scripts = ${common_env_data.extra_scripts}
build_unflags =
${common_env_data.build_unflags}
build_flags =
-Wl,-Map,output.map
${common_env_data.build_flags}
-D COLLECT_PERFDATA
-D LOG_LEVEL=5
-DLOG_LEVEL=5
-DCORE_DEBUG_LEVEL=0
-DESP32C3
-DARDUINO_ESP32C3_DEV
-DUSE_SERIAL0
lib_deps =
${common_env_data.lib_deps}
https://github.com/mp-se/NimBLE-Arduino#1.3.8 # https://github.com/h2zero/NimBLE-Arduino
board = featheresp32
${common_env_data.lib_deps32}
lib_ignore =
board = lolin_c3_mini
build_type = release
board_build.partitions = part32.csv
board_build.filesystem = littlefs
monitor_filters = esp32_exception_decoder
board_build.embed_txtfiles =
html/calibration.min.htm
html/config.min.htm
html/firmware.min.htm
html/format.min.htm
html/about.min.htm
html/index.min.htm
html/test.min.htm
[env:gravity32c3-debug]
framework = ${common_env_data.framework}
platform = ${common_env_data.platform32}
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
monitor_filters = time, colorize, log2file, esp32_exception_decoder
extra_scripts = ${common_env_data.extra_scripts}
upload_port = COM8
debug_tool = esp-prog
debug_init_break = break setup
build_unflags =
-DCFG_DISABLE_LOGGING
-DGYRO_DISABLE_LOGGING
-DCALC_DISABLE_LOGGING
-DHELPER_DISABLE_LOGGING
-DPUSH_DISABLE_LOGGING
-DTSEN_DISABLE_LOGGING
-DWIFI_DISABLE_LOGGING
-DWEB_DISABLE_LOGGING
-DMAIN_DISABLE_LOGGING
${common_env_data.build_unflags}
build_flags =
-Wl,-Map,output.map
${common_env_data.build_flags}
-DLOG_LEVEL=6
-DCORE_DEBUG_LEVEL=5
-DJTAG_DEBUG
-DESP32C3
-DUSE_SERIAL0
-DARDUINO_ESP32C3_DEV
-DCOLLECT_PERFDATA # Collect runtime data for a few defined methods to measure time, dumped to serial and/or influxdb
lib_deps =
${common_env_data.lib_deps}
${common_env_data.lib_deps32}
lib_ignore =
board = esp32-c3-devkitm-1
build_type = debug
board_build.partitions = part32.csv
board_build.filesystem = littlefs
board_build.embed_txtfiles =
html/calibration.min.htm
html/config.min.htm
html/firmware.min.htm
html/format.min.htm
html/about.min.htm
html/index.min.htm
html/test.min.htm
; [env:gravity32s2-release]
; framework = ${common_env_data.framework}
; platform = ${common_env_data.platform32}
; upload_speed = ${common_env_data.upload_speed}
; monitor_speed = ${common_env_data.monitor_speed}
; extra_scripts = ${common_env_data.extra_scripts}
; build_unflags =
; ${common_env_data.build_unflags}
; build_flags =
; -Wl,-Map,output.map
; ${common_env_data.build_flags}
; -DLOG_LEVEL=5
; -DCORE_DEBUG_LEVEL=0
; -DESP32S2
; -DARDUINO_ESP32S2_DEV
; lib_deps =
; ${common_env_data.lib_deps}
; ${common_env_data.lib_deps32}
; lib_ignore =
; board = lolin_s2_mini
; build_type = debug
; board_build.partitions = part32.csv
; board_build.filesystem = littlefs
; board_build.embed_txtfiles =
; html/calibration.min.htm
; html/config.min.htm
; html/firmware.min.htm
; html/format.min.htm
; html/about.min.htm
; html/index.min.htm
; html/test.min.htm

View File

@ -23,12 +23,6 @@ def after_build(source, target, env):
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
if name == "gravity-perf" :
target = dir + "/bin/firmware-perf.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
if name == "gravity32-release" :
target = dir + "/bin/firmware32.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
@ -40,18 +34,28 @@ def after_build(source, target, env):
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
if name == "gravity32-perf" :
target = dir + "/bin/firmware32-perf.bin"
if name == "gravity32c3-release" :
target = dir + "/bin/firmware32c3.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
if name == "gravity32-release2" :
target = dir + "/bin/firmware32_2.bin"
target = dir + "/bin/partitions32c3.bin"
source = dir + "/.pio/build/" + name + "/partitions.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
if name == "gravity32s2-release" :
target = dir + "/bin/firmware32s2.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
target = dir + "/bin/partitions32s2.bin"
source = dir + "/.pio/build/" + name + "/partitions.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
print( "Adding custom build step (copy firmware): ")
env.AddPostAction("buildprog", after_build)

View File

@ -1,34 +0,0 @@
Import("env")
import shutil, os
print( "Executing custom step " )
dir = env.GetLaunchDir()
source = dir + "/html/"
target = dir + "/data/"
print( "Copy html-files from " + source + " -> " + target )
os.makedirs(os.path.dirname( target ), exist_ok=True)
file = "about.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "calibration.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "config.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "index.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "upload.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "format.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "test.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )
file = "firmware.min.htm"
#print( "Copy file: " + source + file + "->" + target + file)
shutil.copyfile( source + file, target + file )

View File

@ -12,42 +12,6 @@ def after_build(source, target, env):
dir = env.GetLaunchDir()
#name = env.get( "PIOENV" )
# Copy file 1
source = dir + "/data/index.min.htm"
target = dir + "/bin/index.min.htm"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
# Copy file 2
source = dir + "/data/config.min.htm"
target = dir + "/bin/config.min.htm"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
# Copy file 3
source = dir + "/data/about.min.htm"
target = dir + "/bin/about.min.htm"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
# Copy file 4
source = dir + "/data/calibration.min.htm"
target = dir + "/bin/calibration.min.htm"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
# Copy file 5
source = dir + "/data/format.min.htm"
target = dir + "/bin/format.min.htm"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
# Copy file 6
source = dir + "/data/test.min.htm"
target = dir + "/bin/test.min.htm"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
target = dir + "/bin/version.json"
ver = get_build_flag_value("CFG_APPVER")

View File

@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if defined(ESP32)
#if defined(ESP32) && !defined(ESP32S2)
#include <ble.hpp>
#include <string>
@ -99,4 +99,4 @@ void BleSender::sendData(float tempF, float gravSG) {
delay(100);
}
#endif // ESP32
#endif // ESP32 && !ESP32S2

View File

@ -24,14 +24,12 @@ SOFTWARE.
#ifndef SRC_BLE_HPP_
#define SRC_BLE_HPP_
#if defined(ESP32)
#if defined(ESP32) && !defined(ESP32S2)
#include <Arduino.h>
#include <NimBLEBeacon.h>
#include <NimBLEDevice.h>
#include <config.hpp>
#include <main.hpp>
class BleSender {
private:
BLEAdvertising* _advertising;
@ -43,5 +41,5 @@ class BleSender {
void sendData(float tempF, float gravSG);
};
#endif // ESP32
#endif // ESP32 && !ESP32S2
#endif // SRC_BLE_HPP_

View File

@ -153,8 +153,8 @@ bool Config::saveFile() {
createJson(doc);
#if LOG_LEVEL == 6 && !defined(DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
serializeJson(doc, configFile);
@ -192,8 +192,8 @@ bool Config::loadFile() {
DynamicJsonDocument doc(3000);
DeserializationError err = deserializeJson(doc, configFile);
#if LOG_LEVEL == 6
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
configFile.close();
@ -395,8 +395,8 @@ bool AdvancedConfig::saveFile() {
doc[PARAM_HW_IGNORE_LOW_ANGLES] = this->isIgnoreLowAnges();
#if LOG_LEVEL == 6 && !defined(DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
serializeJson(doc, configFile);
@ -434,8 +434,8 @@ bool AdvancedConfig::loadFile() {
DynamicJsonDocument doc(512);
DeserializationError err = deserializeJson(doc, configFile);
#if LOG_LEVEL == 6
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
configFile.close();

View File

@ -143,7 +143,15 @@ class Config {
String _mDNS = "";
String _otaURL = "";
char _tempFormat = 'C';
#if defined(ESP8266)
float _voltageFactor = 1.59;
#elif defined(ESP32C3)
float _voltageFactor = 1.3;
#elif defined(ESP32S2)
float _voltageFactor = 1.3;
#else // ESP32
float _voltageFactor = 1.3;
#endif
float _voltageConfig = 4.15;
float _tempSensorAdjC = 0;
int _sleepInterval = 900;

View File

@ -314,14 +314,14 @@ void GyroSensor::calibrateSensor() {
Log.verbose(F("GYRO: Calibrating sensor" CR));
#endif
// accelgyro.PrintActiveOffsets();
// Serial.print( CR );
// EspSerial.print( CR );
accelgyro.setDLPFMode(MPU6050_DLPF_BW_5);
accelgyro.CalibrateAccel(6); // 6 = 600 readings
accelgyro.CalibrateGyro(6);
accelgyro.PrintActiveOffsets();
Serial.print(CR);
EspSerial.print(CR);
_calibrationOffset.ax = accelgyro.getXAccelOffset();
_calibrationOffset.ay = accelgyro.getYAccelOffset();

View File

@ -36,9 +36,6 @@ SOFTWARE.
#include <tempsensor.hpp>
#include <wifi.hpp>
SerialDebug mySerial;
BatteryVoltage myBatteryVoltage;
// tcp cleanup, to avoid memory crash.
struct tcp_pcb;
extern struct tcp_pcb* tcp_tw_pcbs;
@ -64,7 +61,67 @@ void checkResetReason() {
writeErrorLog(&s[0]);
}
#else // defined (ESP32)
#warning "Todo: Handle reset reasons on ESP32"
RESET_REASON r = rtc_get_reset_reason(
0); // We only check cpu0 since we dont use cpu1 on the esp32
String rStr;
switch (r) {
case 0:
rStr = F("None");
break;
case 1:
rStr = F("vbat power on reset");
break;
case 3:
rStr = F("software reset digital core");
break;
case 4:
rStr = F("legacy watch dog reset digital core");
break;
case 5:
rStr = F("deep Sleep reset digital core");
break;
case 6:
rStr = F("reset by SLC module, reset digital core");
break;
case 7:
rStr = F("timer Group0 Watch dog reset digital core");
break;
case 8:
rStr = F("timer Group1 Watch dog reset digital core");
break;
case 9:
rStr = F("RTC Watch dog Reset digital core");
break;
case 10:
rStr = F("instrusion tested to reset CPU");
break;
case 11:
rStr = F("time Group reset CPU");
break;
case 12:
rStr = F("software reset CPU");
break;
case 13:
rStr = F("RTC Watch dog Reset CPU");
break;
case 14:
rStr = F("for APP CPU, reseted by PRO CPU");
break;
case 15:
rStr = F("reset when the vdd voltage is not stable");
break;
case 16:
rStr = F("RTC Watch dog reset digital core and rtc module");
break;
default:
rStr = F("unknown reset reason");
break;
}
Log.notice(F("HELP: Last reset cause '%s' (%d)" CR), rStr.c_str(), r);
#warning "TODO: Implement logging of crashes for esp32"
#endif
}
@ -181,10 +238,9 @@ void printBuildOptions() {
SerialDebug::SerialDebug(const uint32_t serialSpeed) {
// Start serial with auto-detected rate (default to defined BAUD)
Serial.flush();
Serial.begin(serialSpeed);
getLog()->begin(LOG_LEVEL, &Serial, true);
EspSerial.begin(serialSpeed);
EspSerial.println("Serial connection established");
getLog()->begin(LOG_LEVEL, &EspSerial, true);
getLog()->setPrefix(printTimestamp);
getLog()->notice(F("SDBG: Serial logging started at %u." CR), serialSpeed);
}
@ -195,6 +251,14 @@ void printTimestamp(Print* _logOutput, int _logLevel) {
_logOutput->print(c);
}
BatteryVoltage::BatteryVoltage() {
#if defined(ESP8266)
pinMode(PIN_A0, INPUT);
#else
pinMode(PIN_A0, INPUT_PULLDOWN);
#endif
}
void BatteryVoltage::read() {
// The analog pin can only handle 3.3V maximum voltage so we need to reduce
// the voltage (from max 5V)
@ -342,7 +406,7 @@ void PerfLogging::pushInflux() {
// Send HTTP POST request
String auth = "Token " + String(myConfig.getInfluxDb2PushToken());
http.addHeader(F("Authorization"), auth.c_str());
http.setTimeout(myAdvancedConfig.getPushTimeout());
http.setTimeout(myAdvancedConfig.getPushTimeout() * 1000);
int httpResponseCode = http.POST(body);
if (httpResponseCode == 204) {

View File

@ -88,9 +88,10 @@ class FloatHistoryLog {
class BatteryVoltage {
private:
float _batteryLevel;
float _batteryLevel = 0;
public:
BatteryVoltage();
void read();
float getVoltage() { return _batteryLevel; }
};

View File

@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <ble.hpp>
#undef LOG_LEVEL_ERROR
#undef LOG_LEVEL_INFO
#include <calc.hpp>
#include <config.hpp>
#include <gyro.hpp>
@ -33,12 +35,14 @@ SOFTWARE.
#include <wifi.hpp>
// #define FORCE_GRAVITY_MODE
SerialDebug mySerial;
BatteryVoltage myBatteryVoltage;
// Define constats for this program
#ifdef DEACTIVATE_SLEEPMODE
const int interval = 1000; // ms, time to wait between changes to output
#else
int interval = 200; // ms, time to wait between changes to output
int interval = 200; // ms, time to wait between changes to output
#endif
bool sleepModeAlwaysSkip =
false; // Flag set in web interface to override normal behaviour
@ -117,12 +121,8 @@ void checkSleepMode(float angle, float volt) {
Log.notice(
F("Main: Storage mode entered, going to sleep for maximum time." CR));
#if defined(ESP8266)
// ESP.deepSleep(ESP.deepSleepMax());
ESP.deepSleep(0); // indefinite sleep
#else
#warning "Check and test the max deep sleep for esp32"
// deepSleep(70 * 60); // quick search on internet suggest max time is 70
// min
ESP.deepSleep(0); // indefinite sleep
#endif
}
@ -137,8 +137,8 @@ void setup() {
// Add a delay so that serial is started.
// delay(3000);
#endif
// Main startup
// Main startup
#if defined(ESP8266)
Log.notice(F("Main: Started setup for %s." CR),
String(ESP.getChipId(), HEX).c_str());
@ -205,6 +205,8 @@ void setup() {
myBatteryVoltage.read();
checkSleepMode(myGyro.getAngle(), myBatteryVoltage.getVoltage());
Log.notice(F("Main: Battery %F V, Gyro=%F, Run-mode=%d." CR),
myBatteryVoltage.getVoltage(), myGyro.getAngle(), runMode);
#if defined(ESP32)
if (!myConfig.isWifiPushActive() && runMode == RunMode::gravityMode) {
@ -308,13 +310,13 @@ bool loopReadGravity() {
pushMillis = millis();
LOG_PERF_START("loop-push");
#if defined(ESP32)
#if defined(ESP32) && !defined(ESP32S2)
if (myConfig.isBLEActive()) {
BleSender ble(myConfig.getColorBLE());
ble.sendData(convertCtoF(tempC), gravitySG);
Log.notice(F("MAIN: Broadcast data over bluetooth." CR));
}
#endif
#endif // ESP32 && !ESP32S2
if (myWifi.isConnected()) { // no need to try if there is no wifi
// connection.
@ -386,10 +388,10 @@ void loop() {
break;
case RunMode::configurationMode:
if (myWifi.isConnected()) myWebServerHandler.loop();
myWebServerHandler.loop();
myWifi.loop();
loopGravityOnInterval();
delay(1);
// If we switched mode, dont include this in the log.
if (runMode != RunMode::configurationMode) skipRunTimeLog = true;

View File

@ -45,19 +45,62 @@ extern RunMode runMode;
#define PIN_DS D6
#define PIN_LED 2
// #define PIN_A0 A0
#else // defined (ESP32)
#elif defined(ESP32C3)
#include <FS.h>
#include <LittleFS.h>
#include "esp32c3/rom/rtc.h"
#define ESPhttpUpdate httpUpdate
#define ESP_RESET ESP.restart
#define ESP8266WebServer WebServer
#define PIN_SDA 17
#define PIN_SCL 16
#define PIN_DS 19
#define PIN_A0 36
#define PIN_LED 2
#if defined(JTAG_DEBUG)
#define PIN_SDA 8
#define PIN_SCL 9
#warning "ESP32C3 JTAG debugging enabled, using GYRO on GPIO 8/9"
#else
#define PIN_SDA 7
#define PIN_SCL 6
#endif
#define PIN_DS A3
#define PIN_A0 A0
// This should be the LED_BUILTIN, but that is also connected SDA (Gyro) so we
// cannot use both. So we point LED to pin 8 which is not used.
#define PIN_LED 8
/*
#elif defined(ESP32S2)
#include <FS.h>
#include <LittleFS.h>
#include "esp32s2/rom/rtc.h"
#define ESPhttpUpdate httpUpdate
#define ESP_RESET ESP.restart
#define ESP8266WebServer WebServer
#define PIN_SDA SDA
#define PIN_SCL SCL
#define PIN_DS A8
#define PIN_A0 A2
#define PIN_LED LED_BUILTIN
*/
#else // defined (ESP32)
#include <FS.h>
#include <LittleFS.h>
#include "esp32/rom/rtc.h"
#define ESPhttpUpdate httpUpdate
#define ESP_RESET ESP.restart
#define ESP8266WebServer WebServer
#define PIN_SDA D3
#define PIN_SCL D4
#define PIN_DS D6
#define PIN_LED LED_BUILTIN
// #define PIN_A0 A4
#endif
#define PIN_LED 2
#if defined(ESP32C3) && defined(USE_SERIAL0)
#define EspSerial Serial0
// #warning "Using Serial0 for output RX/TX pins on ESP32C3"
#else
#define EspSerial Serial
#endif
#endif // SRC_MAIN_HPP_

View File

@ -23,23 +23,16 @@ SOFTWARE.
*/
#if defined(ESP8266)
#define INCBIN_OUTPUT_SECTION ".irom.text"
#endif
#include <incbin.h>
#include <resources.hpp>
#if defined(EMBED_HTML)
// Using minify to reduce memory usage. Reducing RAM memory usage with about 7%
INCBIN(IndexHtm, "data/index.min.htm");
INCBIN(ConfigHtm, "data/config.min.htm");
INCBIN(CalibrationHtm, "data/calibration.min.htm");
INCBIN(FormatHtm, "data/format.min.htm");
INCBIN(TestHtm, "data/test.min.htm");
INCBIN(AboutHtm, "data/about.min.htm");
#else
// Minium web interface for uploading htm files
INCBIN(UploadHtm, "data/upload.min.htm");
INCBIN(IndexHtm, "html/index.min.htm");
INCBIN(ConfigHtm, "html/config.min.htm");
INCBIN(CalibrationHtm, "html/calibration.min.htm");
INCBIN(FormatHtm, "html/format.min.htm");
INCBIN(TestHtm, "html/test.min.htm");
INCBIN(AboutHtm, "html/about.min.htm");
INCBIN(FirmwareHtm, "html/firmware.min.htm");
#endif
INCBIN(FirmwareHtm, "data/firmware.min.htm");
// EOF

View File

@ -174,11 +174,11 @@ class TemplatingEngine {
void dumpAll() {
int max = sizeof(_items) / sizeof(KeyVal);
for (int i = 0; i < max; i++) {
Serial.print("Key=\'");
Serial.print(_items[i].key.c_str());
Serial.print("\', Val=\'");
Serial.print(_items[i].val.c_str());
Serial.println("\'");
EspSerial.print("Key=\'");
EspSerial.print(_items[i].key.c_str());
EspSerial.print("\', Val=\'");
EspSerial.print(_items[i].val.c_str());
EspSerial.println("\'");
}
}
@ -196,7 +196,6 @@ class TemplatingEngine {
void freeMemory() {
if (_output) free(_output);
_output = 0;
}
void initialize(float angle, float gravitySG, float corrGravitySG,

View File

@ -37,9 +37,6 @@ WebServerHandler myWebServerHandler; // My wrapper class fr webserver functions
extern bool sleepModeActive;
extern bool sleepModeAlwaysSkip;
//
// Callback from webServer when / has been accessed.
//
void WebServerHandler::webHandleConfig() {
LOG_PERF_START("webserver-api-config");
Log.notice(F("WEB : webServer callback for /api/config(get)." CR));
@ -90,13 +87,17 @@ void WebServerHandler::webHandleConfig() {
#if defined(ESP8266)
doc[PARAM_PLATFORM] = "esp8266";
#else
#elif defined(ESP32C3)
doc[PARAM_PLATFORM] = "esp32c3";
#elif defined(ESP32S2)
doc[PARAM_PLATFORM] = "esp32s3";
#else // esp32 mini
doc[PARAM_PLATFORM] = "esp32";
#endif
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
String out;
@ -107,173 +108,64 @@ void WebServerHandler::webHandleConfig() {
LOG_PERF_STOP("webserver-api-config");
}
//
// Callback from webServer when / has been accessed.
//
void WebServerHandler::webHandleUpload() {
LOG_PERF_START("webserver-api-upload");
Log.notice(F("WEB : webServer callback for /api/upload(get)." CR));
DynamicJsonDocument doc(300);
doc["index"] = checkHtmlFile(WebServerHandler::HTML_INDEX);
doc["config"] = checkHtmlFile(WebServerHandler::HTML_CONFIG);
doc["calibration"] = checkHtmlFile(WebServerHandler::HTML_CALIBRATION);
doc["format"] = checkHtmlFile(WebServerHandler::HTML_FORMAT);
doc["about"] = checkHtmlFile(WebServerHandler::HTML_ABOUT);
doc["test"] = checkHtmlFile(WebServerHandler::HTML_TEST);
#if defined(ESP8266)
JsonArray files = doc.createNestedArray(PARAM_FILES);
// Show files in the filessytem at startup
FSInfo fs;
LittleFS.info(fs);
Dir dir = LittleFS.openDir("/");
while (dir.next()) {
JsonObject obj = files.createNestedObject();
obj[PARAM_FILE_NAME] = dir.fileName();
obj[PARAM_FILE_SIZE] = dir.fileSize();
}
#else // defined(ESP32)
JsonArray files = doc.createNestedArray(PARAM_FILES);
File dir = LittleFS.open("/");
while (true) {
File entry = dir.openNextFile();
if (!entry) {
// no more files
break;
}
if (!entry.isDirectory()) {
JsonObject obj = files.createNestedObject();
obj[PARAM_FILE_NAME] = entry.name();
obj[PARAM_FILE_SIZE] = entry.size();
}
entry.close();
}
dir.close();
#endif
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
#endif
String out;
out.reserve(300);
serializeJson(doc, out);
doc.clear();
_server->send(200, "application/json", out.c_str());
LOG_PERF_STOP("webserver-api-upload");
}
void WebServerHandler::webHandleUploadFile() {
LOG_PERF_START("webserver-api-upload-file");
Log.verbose(F("WEB : webServer callback for /api/upload(post)." CR));
HTTPUpload& upload = _server->upload();
String f = upload.filename;
bool validFilename = false;
bool firmware = false;
if (f.equalsIgnoreCase("index.min.htm") ||
f.equalsIgnoreCase("calibration.min.htm") ||
f.equalsIgnoreCase("config.min.htm") ||
f.equalsIgnoreCase("format.min.htm") ||
f.equalsIgnoreCase("test.min.htm") ||
f.equalsIgnoreCase("about.min.htm")) {
validFilename = true;
}
if (f.endsWith(".bin")) {
validFilename = true;
firmware = true;
}
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
Log.verbose(
F("WEB : webServer callback for /api/upload, receiving file %s, %d(%d) "
"valid=%s, firmware=%s." CR),
f.c_str(), upload.currentSize, upload.totalSize,
validFilename ? "yes" : "no", firmware ? "yes" : "no");
Log.verbose(F("WEB : webServer callback for /api/upload, receiving file %s, "
"%d(%d)." CR),
f.c_str(), upload.currentSize, upload.totalSize);
#endif
if (firmware) {
// Handle firmware update, hardcode since function return wrong value.
// (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
uint32_t maxSketchSpace = MAX_SKETCH_SPACE;
// Handle firmware update, hardcode since function return wrong value.
// (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
uint32_t maxSketchSpace = MAX_SKETCH_SPACE;
if (upload.status == UPLOAD_FILE_START) {
_uploadReturn = 200;
Log.notice(F("WEB : Start firmware upload, max sketch size %d kb." CR),
maxSketchSpace / 1024);
if (upload.status == UPLOAD_FILE_START) {
_uploadReturn = 200;
Log.notice(F("WEB : Start firmware upload, max sketch size %d kb." CR),
maxSketchSpace / 1024);
if (!Update.begin(maxSketchSpace, U_FLASH, PIN_LED)) {
writeErrorLog("WEB : Not enough space to store for this firmware.");
_uploadReturn = 500;
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
Log.notice(F("WEB : Writing firmware upload %d (%d)." CR),
upload.totalSize, maxSketchSpace);
if (upload.totalSize > maxSketchSpace) {
Log.error(F("WEB : Firmware file is to large." CR));
_uploadReturn = 500;
} else if (Update.write(upload.buf, upload.currentSize) !=
upload.currentSize) {
Log.warning(F("WEB : Firmware write was unsuccessful." CR));
_uploadReturn = 500;
}
} else if (upload.status == UPLOAD_FILE_END) {
Log.notice(F("WEB : Finish firmware upload." CR));
if (Update.end(true)) {
_server->send(200);
delay(500);
ESP_RESET();
} else {
writeErrorLog("WEB : Failed to finish firmware flashing error=%d",
Update.getError());
_uploadReturn = 500;
}
} else {
Update.end();
Log.notice(F("WEB : Firmware flashing aborted." CR));
if (!Update.begin(maxSketchSpace, U_FLASH, PIN_LED)) {
writeErrorLog("WEB : Not enough space to store for this firmware.");
_uploadReturn = 500;
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
Log.notice(F("WEB : Writing firmware upload %d (%d)." CR), upload.totalSize,
maxSketchSpace);
delay(0);
} else {
// Handle HTML file upload
if (upload.status == UPLOAD_FILE_START) {
_uploadReturn = 200;
Log.notice(F("WEB : Start html upload." CR));
if (validFilename) _uploadFile = LittleFS.open(f, "w");
} else if (upload.status == UPLOAD_FILE_WRITE) {
Log.notice(F("WEB : Writing html upload." CR));
if (_uploadFile) _uploadFile.write(upload.buf, upload.currentSize);
} else if (upload.status == UPLOAD_FILE_END) {
Log.notice(F("WEB : Finish html upload." CR));
if (_uploadFile) {
_uploadFile.close();
Log.notice(F("WEB : Html file uploaded %d bytes." CR),
upload.totalSize);
}
_server->sendHeader("Location", "/");
_server->send(303);
} else {
_server->send(500, "text/plain", "Couldn't upload html file.");
if (upload.totalSize > maxSketchSpace) {
Log.error(F("WEB : Firmware file is to large." CR));
_uploadReturn = 500;
} else if (Update.write(upload.buf, upload.currentSize) !=
upload.currentSize) {
Log.warning(F("WEB : Firmware write was unsuccessful." CR));
_uploadReturn = 500;
}
} else if (upload.status == UPLOAD_FILE_END) {
Log.notice(F("WEB : Finish firmware upload." CR));
if (Update.end(true)) {
_server->send(200);
delay(500);
ESP_RESET();
} else {
writeErrorLog("WEB : Failed to finish firmware flashing error=%d",
Update.getError());
_uploadReturn = 500;
}
} else {
Update.end();
Log.notice(F("WEB : Firmware flashing aborted." CR));
_uploadReturn = 500;
}
delay(0);
LOG_PERF_STOP("webserver-api-upload-file");
}
//
// Callback from webServer when / has been accessed.
//
void WebServerHandler::webHandleCalibrate() {
LOG_PERF_START("webserver-api-calibrate");
String id = _server->arg(PARAM_ID);
@ -307,6 +199,7 @@ void WebServerHandler::webHandleFactoryDefaults() {
LittleFS.remove(TPL_FNAME_INFLUXDB);
LittleFS.remove(TPL_FNAME_MQTT);
LittleFS.end();
Log.notice(F("WEB : Deleted files in filesystem, rebooting." CR));
delay(500);
ESP_RESET();
} else {
@ -377,13 +270,17 @@ void WebServerHandler::webHandleStatus() {
#if defined(ESP8266)
doc[PARAM_PLATFORM] = "esp8266";
#else
#elif defined(ESP32C3)
doc[PARAM_PLATFORM] = "esp32c3";
#elif defined(ESP32S2)
doc[PARAM_PLATFORM] = "esp32s3";
#else // esp32 mini
doc[PARAM_PLATFORM] = "esp32";
#endif
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
String out;
@ -439,9 +336,6 @@ void WebServerHandler::webHandleStatusSleepmode() {
LOG_PERF_STOP("webserver-api-sleepmode");
}
//
// Update device settings.
//
void WebServerHandler::webHandleConfigDevice() {
LOG_PERF_START("webserver-api-config-device");
String id = _server->arg(PARAM_ID);
@ -471,9 +365,6 @@ void WebServerHandler::webHandleConfigDevice() {
LOG_PERF_STOP("webserver-api-config-device");
}
//
// Update push settings.
//
void WebServerHandler::webHandleConfigPush() {
LOG_PERF_START("webserver-api-config-push");
String id = _server->arg(PARAM_ID);
@ -535,9 +426,6 @@ void WebServerHandler::webHandleConfigPush() {
LOG_PERF_STOP("webserver-api-config-push");
}
//
// Get string with all received arguments. Used for debugging only.
//
String WebServerHandler::getRequestArguments() {
String debug;
@ -554,9 +442,6 @@ String WebServerHandler::getRequestArguments() {
return debug;
}
//
// Update gravity settings.
//
void WebServerHandler::webHandleConfigGravity() {
LOG_PERF_START("webserver-api-config-gravity");
String id = _server->arg(PARAM_ID);
@ -591,9 +476,6 @@ void WebServerHandler::webHandleConfigGravity() {
LOG_PERF_STOP("webserver-api-config-gravity");
}
//
// Update hardware settings.
//
void WebServerHandler::webHandleConfigHardware() {
LOG_PERF_START("webserver-api-config-hardware");
String id = _server->arg(PARAM_ID);
@ -645,9 +527,6 @@ void WebServerHandler::webHandleConfigHardware() {
LOG_PERF_STOP("webserver-api-config-hardware");
}
//
// Update advanced settings.
//
void WebServerHandler::webHandleConfigAdvancedWrite() {
LOG_PERF_START("webserver-api-config-advanced");
String id = _server->arg(PARAM_ID);
@ -723,9 +602,6 @@ void WebServerHandler::webHandleConfigAdvancedWrite() {
LOG_PERF_STOP("webserver-api-config-advanced");
}
//
// Read advanced settings
//
void WebServerHandler::webHandleConfigAdvancedRead() {
LOG_PERF_START("webserver-api-config-advanced");
Log.notice(F("WEB : webServer callback for /api/config/advanced(get)." CR));
@ -754,8 +630,8 @@ void WebServerHandler::webHandleConfigAdvancedRead() {
doc[PARAM_HW_IGNORE_LOW_ANGLES] = myAdvancedConfig.isIgnoreLowAnges();
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
String out;
@ -766,9 +642,6 @@ void WebServerHandler::webHandleConfigAdvancedRead() {
LOG_PERF_STOP("webserver-api-config-advanced");
}
//
// Callback from webServer when / has been accessed.
//
void WebServerHandler::webHandleFormulaRead() {
LOG_PERF_START("webserver-api-formula-read");
Log.notice(F("WEB : webServer callback for /api/formula(get)." CR));
@ -840,8 +713,8 @@ void WebServerHandler::webHandleFormulaRead() {
}
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
String out;
@ -852,9 +725,6 @@ void WebServerHandler::webHandleFormulaRead() {
LOG_PERF_STOP("webserver-api-formula-read");
}
//
// Update format template
//
void WebServerHandler::webHandleConfigFormatWrite() {
LOG_PERF_START("webserver-api-config-format-write");
String id = _server->arg(PARAM_ID);
@ -898,9 +768,6 @@ void WebServerHandler::webHandleConfigFormatWrite() {
LOG_PERF_STOP("webserver-api-config-format-write");
}
//
// Get format with real data
//
void WebServerHandler::webHandleTestPush() {
LOG_PERF_START("webserver-api-test-push");
String id = _server->arg(PARAM_ID);
@ -961,18 +828,14 @@ void WebServerHandler::webHandleTestPush() {
doc.clear();
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
serializeJson(doc, Serial);
Serial.print(CR);
serializeJson(doc, EspSerial);
EspSerial.print(CR);
#endif
_server->send(200, "application/json", out.c_str());
LOG_PERF_STOP("webserver-api-test-push");
}
//
// Write file to disk, if there is no data then delete the current file (if it
// exists) = reset to default.
//
bool WebServerHandler::writeFile(String fname, String data) {
if (data.length()) {
data = urldecode(data);
@ -998,9 +861,6 @@ bool WebServerHandler::writeFile(String fname, String data) {
return false;
}
//
// Read file from disk
//
String WebServerHandler::readFile(String fname) {
File file = LittleFS.open(fname, "r");
if (file) {
@ -1014,9 +874,6 @@ String WebServerHandler::readFile(String fname) {
return "";
}
//
// Get format templates
//
void WebServerHandler::webHandleConfigFormatRead() {
LOG_PERF_START("webserver-api-config-format-read");
Log.notice(F("WEB : webServer callback for /api/config/formula(get)." CR));
@ -1063,17 +920,14 @@ void WebServerHandler::webHandleConfigFormatRead() {
out += "\"}";
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
Serial.print(out.c_str());
Serial.print(CR);
EspSerial.print(out.c_str());
EspSerial.print(CR);
#endif
_server->send(200, "application/json", out.c_str());
LOG_PERF_STOP("webserver-api-config-format-read");
}
//
// Update hardware settings.
//
void WebServerHandler::webHandleFormulaWrite() {
LOG_PERF_START("webserver-api-formula-write");
String id = _server->arg(PARAM_ID);
@ -1166,62 +1020,14 @@ void WebServerHandler::webHandleFormulaWrite() {
LOG_PERF_STOP("webserver-api-formula-write");
}
//
// Helper function to check if files exist on file system.
//
const char* WebServerHandler::getHtmlFileName(HtmlFile item) {
Log.notice(F("WEB : Looking up filename for %d." CR), item);
switch (item) {
case HtmlFile::HTML_INDEX:
return "index.min.htm";
case HtmlFile::HTML_CONFIG:
return "config.min.htm";
case HtmlFile::HTML_CALIBRATION:
return "calibration.min.htm";
case HtmlFile::HTML_FORMAT:
return "format.min.htm";
case HtmlFile::HTML_ABOUT:
return "about.min.htm";
case HtmlFile::HTML_TEST:
return "test.min.htm";
}
return "";
}
//
// Helper function to check if files exist on file system.
//
bool WebServerHandler::checkHtmlFile(HtmlFile item) {
const char* fn = getHtmlFileName(item);
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
Log.verbose(F("WEB : Checking for file %s." CR), fn);
#endif
// TODO: We might need to add more checks here like zero file size etc. But
// for now we only check if the file exist.
return LittleFS.exists(fn);
}
//
// Handler for page not found
//
void WebServerHandler::webHandlePageNotFound() {
Log.error(F("WEB : URL not found %s received." CR), _server->uri().c_str());
_server->send(404, "text/plain", F("URL not found"));
}
//
// Setup the Web Server callbacks and start it
//
bool WebServerHandler::setupWebServer() {
Log.notice(F("WEB : Configuring web server." CR));
_server = new ESP8266WebServer();
MDNS.begin(myConfig.getMDNS());
MDNS.addService("http", "tcp", 80);
@ -1240,7 +1046,7 @@ bool WebServerHandler::setupWebServer() {
LittleFS.remove(dir.fileName().c_str());
}
}
#else // defined( ESP32 )
#else // ESP32
File root = LittleFS.open("/");
File f = root.openNextFile();
while (f) {
@ -1258,7 +1064,6 @@ bool WebServerHandler::setupWebServer() {
// Static content
Log.notice(F("WEB : Setting up handlers for web server." CR));
#if defined(EMBED_HTML)
_server->on("/", std::bind(&WebServerHandler::webReturnIndexHtm, this));
_server->on("/index.htm",
std::bind(&WebServerHandler::webReturnIndexHtm, this));
@ -1272,31 +1077,6 @@ bool WebServerHandler::setupWebServer() {
std::bind(&WebServerHandler::webReturnAboutHtm, this));
_server->on("/test.htm",
std::bind(&WebServerHandler::webReturnTestHtm, this));
#else
// Check if the html files exist, if so serve them, else show the static
// upload page.
if (checkHtmlFile(HTML_INDEX) && checkHtmlFile(HTML_CONFIG) &&
checkHtmlFile(HTML_CALIBRATION) && checkHtmlFile(HTML_FORMAT) &&
checkHtmlFile(HTML_ABOUT) && checkHtmlFile(HTML_TEST)) {
Log.notice(F("WEB : All html files exist, starting in normal mode." CR));
_server->serveStatic("/", LittleFS, "/index.min.htm");
_server->serveStatic("/index.htm", LittleFS, "/index.min.htm");
_server->serveStatic("/config.htm", LittleFS, "/config.min.htm");
_server->serveStatic("/about.htm", LittleFS, "/about.min.htm");
_server->serveStatic("/test.htm", LittleFS, "/test.min.htm");
_server->serveStatic("/calibration.htm", LittleFS, "/calibration.min.htm");
_server->serveStatic("/format.htm", LittleFS, "/format.min.htm");
// Also add the static upload view in case we we have issues that needs to
// be fixed.
_server->on("/upload.htm",
std::bind(&WebServerHandler::webReturnUploadHtm, this));
} else {
Log.error(F("WEB : Missing html files, starting with upload UI." CR));
_server->on("/", std::bind(&WebServerHandler::webReturnUploadHtm, this));
}
#endif
_server->on("/firmware.htm",
std::bind(&WebServerHandler::webReturnFirmwareHtm, this));
_server->serveStatic("/log", LittleFS, ERR_FILENAME);
@ -1320,9 +1100,6 @@ bool WebServerHandler::setupWebServer() {
std::bind(&WebServerHandler::webHandleStatus, this));
_server->on("/api/clearwifi", HTTP_GET,
std::bind(&WebServerHandler::webHandleClearWIFI, this));
_server->on(
"/api/upload", HTTP_GET,
std::bind(&WebServerHandler::webHandleUpload, this)); // Get upload.json
_server->on("/api/upload", HTTP_POST,
std::bind(&WebServerHandler::webReturnOK, this),

View File

@ -29,26 +29,42 @@ SOFTWARE.
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#define MAX_SKETCH_SPACE 1044464
#else // defined (ESP32)
#else
#include <ESPmDNS.h>
#include <Update.h>
#include <WebServer.h>
#include <WiFi.h>
#define MAX_SKETCH_SPACE 1835008
#endif
#include <incbin.h>
#if defined(EMBED_HTML)
#if defined(ESP8266)
#include <incbin.h>
INCBIN_EXTERN(IndexHtm);
INCBIN_EXTERN(ConfigHtm);
INCBIN_EXTERN(CalibrationHtm);
INCBIN_EXTERN(FormatHtm);
INCBIN_EXTERN(TestHtm);
INCBIN_EXTERN(AboutHtm);
#else
INCBIN_EXTERN(UploadHtm);
#endif
INCBIN_EXTERN(FirmwareHtm);
#else // ESP32
extern const uint8_t indexHtmStart[] asm("_binary_html_index_min_htm_start");
extern const uint8_t indexHtmEnd[] asm("_binary_html_index_min_htm_end");
extern const uint8_t configHtmStart[] asm("_binary_html_config_min_htm_start");
extern const uint8_t configHtmEnd[] asm("_binary_html_config_min_htm_end");
extern const uint8_t calibrationHtmStart[] asm(
"_binary_html_calibration_min_htm_start");
extern const uint8_t calibrationHtmEnd[] asm(
"_binary_html_calibration_min_htm_end");
extern const uint8_t formatHtmStart[] asm("_binary_html_format_min_htm_start");
extern const uint8_t formatHtmEnd[] asm("_binary_html_format_min_htm_end");
extern const uint8_t testHtmStart[] asm("_binary_html_test_min_htm_start");
extern const uint8_t testHtmEnd[] asm("_binary_html_test_min_htm_end");
extern const uint8_t aboutHtmStart[] asm("_binary_html_about_min_htm_start");
extern const uint8_t aboutHtmEnd[] asm("_binary_html_about_min_htm_end");
extern const uint8_t firmwareHtmStart[] asm(
"_binary_html_firmware_min_htm_start");
extern const uint8_t firmwareHtmEnd[] asm("_binary_html_firmware_min_htm_end");
#endif
class WebServerHandler {
private:
@ -75,7 +91,6 @@ class WebServerHandler {
void webHandleFactoryDefaults();
void webHandleCalibrate();
void webHandleUploadFile();
void webHandleUpload();
void webHandleLogClear();
void webHandlePageNotFound();
@ -86,7 +101,7 @@ class WebServerHandler {
// Inline functions.
void webReturnOK() { _server->send(_uploadReturn); }
#if defined(EMBED_HTML)
#if defined(ESP8266)
void webReturnIndexHtm() {
_server->send_P(200, "text/html", (const char*)gIndexHtmData,
gIndexHtmSize);
@ -110,31 +125,46 @@ class WebServerHandler {
void webReturnTestHtm() {
_server->send_P(200, "text/html", (const char*)gTestHtmData, gTestHtmSize);
}
#else
void webReturnUploadHtm() {
_server->send_P(200, "text/html", (const char*)gUploadHtmData,
gUploadHtmSize);
}
#endif
void webReturnFirmwareHtm() {
_server->send_P(200, "text/html", (const char*)gFirmwareHtmData,
gFirmwareHtmSize);
}
#else // ESP32
void webReturnIndexHtm() {
_server->send_P(200, "text/html", (const char*)indexHtmStart,
strlen(reinterpret_cast<const char*>(&indexHtmStart[0])));
}
void webReturnConfigHtm() {
_server->send_P(200, "text/html", (const char*)configHtmStart,
strlen(reinterpret_cast<const char*>(&configHtmStart[0])));
}
void webReturnCalibrationHtm() {
_server->send_P(
200, "text/html", (const char*)calibrationHtmStart,
strlen(reinterpret_cast<const char*>(&calibrationHtmStart[0])));
}
void webReturnFormatHtm() {
_server->send_P(200, "text/html", (const char*)formatHtmStart,
strlen(reinterpret_cast<const char*>(&formatHtmStart[0])));
}
void webReturnAboutHtm() {
_server->send_P(200, "text/html", (const char*)aboutHtmStart,
strlen(reinterpret_cast<const char*>(&aboutHtmStart[0])));
}
void webReturnTestHtm() {
_server->send_P(200, "text/html", (const char*)testHtmStart,
strlen(reinterpret_cast<const char*>(&testHtmStart[0])));
}
void webReturnFirmwareHtm() {
_server->send_P(
200, "text/html", (const char*)firmwareHtmStart,
strlen(reinterpret_cast<const char*>(&firmwareHtmStart[0])));
}
#endif
public:
enum HtmlFile {
HTML_INDEX = 0,
HTML_CONFIG = 1,
HTML_ABOUT = 2,
HTML_CALIBRATION = 3,
HTML_FORMAT = 4,
HTML_TEST = 5
};
bool setupWebServer();
void loop();
bool checkHtmlFile(HtmlFile item);
const char* getHtmlFileName(HtmlFile item);
};
// Global instance created

View File

@ -30,7 +30,6 @@ SOFTWARE.
#include <WiFiClient.h>
#include <WiFiClientSecure.h>
#endif
#include <incbin.h>
#include <config.hpp>
#include <main.hpp>
@ -59,16 +58,10 @@ WifiConnection myWifi;
const char *userSSID = USER_SSID;
const char *userPWD = USER_SSID_PWD;
//
// Initialize
//
void WifiConnection::init() {
myDRD = new DoubleResetDetector(DRD_TIMEOUT, DRD_ADDRESS);
}
//
// Check if we have a valid wifi configuration
//
bool WifiConnection::hasConfig() {
if (strlen(myConfig.getWifiSSID(0))) return true;
if (strlen(userSSID)) return true;
@ -76,49 +69,37 @@ bool WifiConnection::hasConfig() {
// Check if there are stored WIFI Settings we can use.
#if defined(ESP8266)
String ssid = WiFi.SSID();
String pwd = WiFi.psk();
#else
ESP_WiFiManager wifiMgr;
String ssid = wifiMgr.WiFi_SSID();
String pwd = wifiMgr.WiFi_Pass();
#endif
if (ssid.length()) {
Log.notice(F("WIFI: Found credentials in EEPORM." CR));
Log.notice(F("WIFI: Found stored credentials." CR));
myConfig.setWifiSSID(ssid, 0);
if (WiFi.psk().length()) myConfig.setWifiPass(WiFi.psk(), 0);
if (pwd.length()) myConfig.setWifiPass(pwd, 0);
myConfig.saveFile();
return true;
}
#else // defined( ESP32 )
#warning "Cant read SSID property on ESP32 until a connection has been made!"
#endif
return false;
}
//
// Check if the wifi is connected
//
bool WifiConnection::isConnected() { return WiFi.status() == WL_CONNECTED; }
//
// Get the IP adress
//
String WifiConnection::getIPAddress() { return WiFi.localIP().toString(); }
//
// Additional method to detect double reset.
//
bool WifiConnection::isDoubleResetDetected() {
if (strlen(userSSID))
return false; // Ignore this if we have hardcoded settings.
return myDRD->detectDoubleReset();
}
//
// Stop double reset detection
//
void WifiConnection::stopDoubleReset() { myDRD->stop(); }
//
// Start the wifi manager
//
void WifiConnection::startPortal() {
Log.notice(F("WIFI: Starting Wifi config portal." CR));
@ -137,6 +118,11 @@ void WifiConnection::startPortal() {
ESP_WMParameter deviceName(mdns.c_str());
myWifiManager->addParameter(&deviceName);
#if defined(ESP32C3)
Log.notice(F("WIFI: Reducing wifi power for c3 chip." CR));
WiFi.setTxPower(WIFI_POWER_8_5dBm); // Required for ESP32C3 Mini
#endif
myWifiManager->startConfigPortal(WIFI_DEFAULT_SSID, WIFI_DEFAULT_PWD);
if (myWifiManager->getSSID(0).length()) {
@ -165,17 +151,17 @@ void WifiConnection::startPortal() {
ESP_RESET();
}
//
// Call the wifi manager in loop
//
void WifiConnection::loop() { myDRD->loop(); }
//
// Connect to last known access point, non blocking mode.
//
void WifiConnection::connectAsync(int wifiIndex) {
WiFi.persistent(true);
WiFi.mode(WIFI_STA);
#if defined(ESP32C3)
Log.notice(F("WIFI: Reducing wifi power for c3 chip." CR));
WiFi.setTxPower(WIFI_POWER_8_5dBm); // Required for ESP32C3 Mini
#endif
if (strlen(userSSID)) {
Log.notice(F("WIFI: Connecting to wifi using hardcoded settings %s." CR),
userSSID);
@ -188,37 +174,31 @@ void WifiConnection::connectAsync(int wifiIndex) {
}
}
//
// Blocks until wifi connection has been found
//
bool WifiConnection::waitForConnection(int maxTime) {
#if DEBUG_LEVEL == 6
WiFi.printDiag(Serial);
WiFi.printDiag(EspSerial);
#endif
int i = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(100);
if (i % 10) Serial.print(".");
if (i % 10) EspSerial.print(".");
if (i++ >
(maxTime * 10)) { // Try for maxTime seconds. Since delay is 100ms.
writeErrorLog("WIFI: Failed to connect to wifi %d", WiFi.status());
WiFi.disconnect();
Serial.print(CR);
EspSerial.print(CR);
return false; // Return to main that we have failed to connect.
}
}
Serial.print(CR);
EspSerial.print(CR);
Log.notice(F("WIFI: Connected to wifi %s ip=%s." CR), WiFi.SSID().c_str(),
getIPAddress().c_str());
Log.notice(F("WIFI: Using mDNS name %s." CR), myConfig.getMDNS());
return true;
}
//
// Check what network is the strongest.
//
int WifiConnection::findStrongestNetwork() {
if (!myConfig.dualWifiConfigured()) {
Log.notice(F("WIFI: Only one wifi SSID is configured, skipping scan." CR));
@ -252,9 +232,6 @@ int WifiConnection::findStrongestNetwork() {
return 1; // Second network is the strongest
}
//
// Connect to last known access point, blocking mode.
//
bool WifiConnection::connect() {
/*
// Alternative code for connecting to strongest wifi.
@ -300,10 +277,6 @@ bool WifiConnection::connect() {
return true;
}
//
// This will erase the stored credentials and forcing the WIFI manager to AP
// mode.
//
bool WifiConnection::disconnect() {
Log.notice(F("WIFI: Erasing stored WIFI credentials." CR));
// Erase WIFI credentials
@ -311,10 +284,6 @@ bool WifiConnection::disconnect() {
}
#if defined(ACTIVATE_OTA)
//
//
//
bool WifiConnection::updateFirmware() {
if (!_newFirmware) {
Log.notice(F("WIFI: No newer version exist, skipping update." CR));
@ -330,6 +299,10 @@ bool WifiConnection::updateFirmware() {
String serverPath = myConfig.getOtaURL();
#if defined(ESP8266)
serverPath += "firmware.bin";
#elif defined(ESP32C3)
serverPath += "firmware32c3.bin";
#elif defined(ESP32S2)
serverPath += "firmware32s2.bin";
#else // defined (ESP32)
serverPath += "firmware32.bin";
#endif
@ -359,9 +332,6 @@ bool WifiConnection::updateFirmware() {
return false;
}
//
// Download and save file
//
void WifiConnection::downloadFile(HTTPClient &http, String &fname) {
#if LOG_LEVEL == 6 && !defined(WIFI_DISABLE_LOGGING)
Log.verbose(F("WIFI: Download file %s." CR), fname);
@ -378,9 +348,6 @@ void WifiConnection::downloadFile(HTTPClient &http, String &fname) {
}
}
//
// Check what firmware version is available over OTA
//
bool WifiConnection::checkFirmwareVersion() {
#if LOG_LEVEL == 6 && !defined(WIFI_DISABLE_LOGGING)
Log.verbose(F("WIFI: Checking if new version exist." CR));
@ -469,9 +436,6 @@ bool WifiConnection::checkFirmwareVersion() {
return _newFirmware;
}
//
// Parse a version string in the format M.m.p (eg. 1.2.10)
//
bool WifiConnection::parseFirmwareVersionString(int (&num)[3],
const char *version) {
#if LOG_LEVEL == 6 && !defined(WIFI_DISABLE_LOGGING)

View File

@ -84,7 +84,7 @@ GET: /api/status
Retrieve the current device status via an HTTP GET command. Payload is in JSON format.
* ``temp-format`` can be either ``C`` or ``F``
* ``platform`` can be either ``esp8266`` or ``esp32``
* ``platform`` can be either ``esp8266``, ``esp32c3``, ``esp32s2`` or ``esp32``
* ``temp-c`` will be set to -273 C if there is no temp sensor
* ``angle`` will be set to 0 if no valid angle is found and -1 if there is no gyro

View File

@ -29,14 +29,9 @@ In the platformio config there are 3 targets defined
* gravity-debug; Maximum logging for trouble shooting, deep sleep is disabled.
* gravity-release; Standard release
* gravity-perf; Standard release but contains code for measuring performance.
* gravity32-release: Version for ESP32.
* gravity32-perf: Version for ESP32 but contains code for measuring performance.
.. note::
There is an experimental ESP32 target but since platformio only supports SDK 1.0.6 and the WIFI connection is really slow compared to ESP8266,
so the recommendation is to wait for support on 2.0.x branch. With the tested version an wifi connection takes 3-8s on a ESP32 compared
to 0.5s on an ESP8266. There is also a bug in OneWire connected to ESP32 that has not been fixed in the main repository yet.
* gravity32-release: Version for ESP32 mini.
* gravity32-c3-release: Version for ESP32 C3 mini.
* gravity32-s2-release: Version for ESP32 S2 mini.
.. warning::
The debug target can be unstable and crash the device under certain circumstanses. Excessive logging to the serial port can cause corruption and crashes.
@ -91,8 +86,6 @@ This is a list of C++ defines that is used to enable/disable functions in the co
- Done include verbose logging in the corresponding class. Excessive logging may crash device.
* - USE_LITTLEFS
- Use the new filesystem in Ardurino
* - EMBED_HTML
- Html files are included in code, if not defined they are served from the file system.
* - USER_SSID
- If defined the device will always use this SSID
* - USER_SSID_PWD

View File

@ -22,7 +22,7 @@ copyright = '2021-2022, Magnus Persson'
author = 'Magnus Persson'
# The full version, including alpha/beta/rc tags
release = '1.1.0'
release = '1.2.0'
# -- General configuration ---------------------------------------------------
@ -31,6 +31,7 @@ release = '1.1.0'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_copybutton'
]
# Add any paths that contain templates here, relative to this directory.

View File

@ -3,49 +3,89 @@
Hardware
########
There are lots of resources out there on how to build the hardware for an iSpindle so I will not go into details on that part. Here are two of my builds using the iSpindle PCB v4.
iSpindle based on esp8266
=========================
.. image:: images/ispindel.jpg
There are lots of resouces out there on how to build the hardware for an iSpindle so I will not go into details on that part. I typically use one of the
excellent pcb boards that, for example the iSpindel PCB v4.0 from Cherry Philip. Here is one of my standard builds using an esp8266.
.. image:: images/ispindel_esp8266.jpg
:width: 500
:alt: Builds of iSpindel
It's possible to use this PCB and mount an ESP32 on top of that. It must be an pin compatible ESP32 and the one I used was called *ESP32 d1 mini*. Since this is the same width as the PCB you need to
mount it really close to the PCB in order for it to fit in the PET tube/container. I also had to smooth the edge of the ESP32 in order for it to fit.
I would suggest that you try how it fits into the PET tube before soldering it to the PCB. Make sure that the battery is attached since this will be a really tight fit.
You also need to desolder (remove) the RED ON LED from the ESP32 or the battery power will be reduced a lot.
Final thing is to add a resistor between A0 (Analog PIN) and ground of 470k. The reason is that the esp8266 has a build in resistor which
the esp32 does not have. So in order to get a valid voltage (less than 3.2V) on the A0 pin this is needed. Once the modification is done you might
need to adjust the voltage factor so the battery reading is correct.
.. image:: images/esp32.jpg
:width: 500
:alt: Mounting esp32
:alt: iSpindle esp8266
Schema for esp8266 build
------------------------
++++++++++++++++++++++++
.. image:: images/schema_esp8266.png
:width: 700
:alt: Schema esp8266
iSpindle based on esp32
=======================
I've experimented with porting my software version to esp32 and this is a selection of options i have been testing.
.. warning::
Work to support esp32s2 is still ongoing, ESP32-mini and ESP32c3-mini is confirmed to be working. However I would recommend the C3 variant.
.. image:: images/esp32_hardware.jpg
:width: 500
:alt: iSpindle esp32 hardware options
* esp32 mini, this was the first board i tried which is a smaller form factor of the first generetion esp32 with 2 cores. Slow on connecting to wifi is the main downside.
* esp32c3 mini, a newer version based on the latest risc v7 architecture, is seen as the replacement for the esp8266 with bluetooth support.
* esp32s2 mini, similar to the c3 board but without bluetooth support.
It's possible to use this PCB and mount an ESP32 mini on top of that (c3 and s2 are prefered). The esp32 mini is a larger formfactor and can be hard to fit into the tube.
.. note::
You need to add a resistor between A0 (Analog PIN) and ground of 470k. The reason is that the esp8266 has a build in resistor for a voltage divider
which the esp32 does not have. So in order to get a valid voltage (less than 3.2V) on the A0 pin this is needed. Once the modification is done you might
need to adjust the voltage factor so the battery reading is correct.
ESP32c3 mini
++++++++++++
This is model is now fully supported by gravitymon.
.. image:: images/ispindel_esp32c3.jpg
:width: 500
:alt: Esp32c3 mini build
Here is an image of where I added the resistor for the voltage divider.
.. image:: images/esp32_res.jpg
:width: 500
:alt: Esp32c3 adding resistor as voltage dividier.
ESP32s2 mini
++++++++++++
Work in progress...
ESP32 d1 mini
+++++++++++++
I would suggest that you try how it fits into the PET tube before soldering it to the PCB. Make sure that the battery is attached since this will be a really tight fit.
.. image:: images/ispindel_esp32.jpg
:width: 500
:alt: Esp32 mini build
Schema for esp32 build
----------------------
++++++++++++++++++++++
.. note::
This schema assumes that an ESP32 D1 Mini (pin compatible with ESP8266 D1 Mini is used)
The ESP32 has two rows of pins but only the inner row is used. The main difference is the added resistor R3 so we
get a voltage divider for measuring battery. The ESP8266 has a built in resistor thats not visible on the schema.
This schema assumes that an ESP32 D1 Mini (pin compatible with ESP8266 D1 Mini is used). The ESP32 has two rows of pins but
only the inner row is used. The main difference is the added resistor R3 so we get a voltage divider for measuring battery.
The ESP8266 has a built in resistor thats not visible on the schema and this acts as a voltage divider.
.. image:: images/schema_esp32.png
:width: 700
:alt: Schema esp32
Modifying with reed switch
--------------------------
Adding a reed (magnetic) reset switch
=====================================
A reed switch is a switch that reacts to magnetic fields. The ones I have tested are normally open and close in proximity to
a magnet.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 KiB

After

Width:  |  Height:  |  Size: 888 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -7,7 +7,7 @@ Welcome to GravityMon's documentation!
######################################
.. note::
This documentation reflects **v1.1**. Last updated 2022-08-14
This documentation reflects **v1.2 - beta 1**. Last updated 2022-10-15
User interface overview
-----------------------
@ -23,6 +23,7 @@ This animation shows how the user interface is structured, it reflects an older
Main features
-------------
* Support either an ESP8266-d1-mini, ESP32-mini or ESP32C3-mini board (see :ref:`hardware`)
* Operates in two modes gravity monitoring and configuration mode
* Gravity mode is comparable to how the iSpindle works when collecting data
* Configuration mode has a modern HTML5 based web UI. No need to start the access point to change settings

View File

@ -23,30 +23,30 @@ available here `Brewflasher WEB <https://web.brewflasher.com/>`_.
Binaries
********
In the /bin directory you will find 3 different firmware builds;
In the /bin directory you will find 4 different firmware builds;
* **firmware.bin**
This is the standard release build (preferred version)
* **firmware-perf.bin**
This version also submits performance data to an influx database with detailed execution times.
* **firmware32.bin**
This is the standard release build for an ESP32 variant. When flashing an ESP32 you also need the **partition32.bin** file that outlines the flash memory structure. Due to
This is the release build for an ESP32-d1-mini variant. When flashing an ESP32 you also need the *partition32.bin* file that outlines the flash memory structure. Due to
the size of the firmware we are using a custom partition setup.
In these versions all the html files are embedded in the binaries. The file system is currently only used for storing
the configuration file.
* **firmware32c3.bin**
If the software becomes so large the html files can be moved to the file system, but this is not enabled by
default (see compiling for details). This approach makes installation much easier and ensure that html files
and code is in sync.
This is the release build for an ESP32c3-mini variant. When flashing an ESP32 you also need the *partition32c3.bin* file that outlines the flash memory structure. Due to
the size of the firmware we are using a custom partition setup.
Esptool
=======
* **firmware32s2.bin**
This is the release build for an ESP32s2-mini variant. When flashing an ESP32 you also need the *partition32s2.bin* file that outlines the flash memory structure. Due to
the size of the firmware we are using a custom partition setup.
Esptool (esp8266)
=================
The other option for flashing esp8266 device is via the official esptool. Documentation can be found
here; `esptool home page <https://docs.espressif.com/projects/esptool/en/latest/esp32/>`_
@ -61,8 +61,8 @@ If there are issues you can try do erase the flash first using this command;
``esptool.py --port COM4 erase_flash``
iSpindel
========
iSpindel (esp8266)
==================
If you already have the device flashed with iSpindel firmware you can go into the configuration mode where you will find
an option for updating firmware. The option is under the maintenance menu.
@ -101,9 +101,21 @@ To check output from the device (logs) there are several tools out there. I foun
Just select a baud rate of 115200, 8N1.
.. image:: images/serial.png
:width: 800
:width: 600
:alt: Serial output
On the build for esp32c3 the serial output is written to UART0 which is connected to the RX/TX pins on the chip. This way the serial output can be viewed
without a connection to the USB port, convinient when running the device on battery power.
You need a USB to TTL cable that you connect the TX, RX and GND pins. **Dont connect the power pin** if you are powering the device from USB or Battery.
.. image:: images/usb-ttl.jpg
:width: 300
:alt: USB to TTL cable
.. image:: images/serial_esp32c3.jpg
:width: 300
:alt: Serial output ESP32c3
.. _setup_wifi:
@ -130,7 +142,7 @@ successful then it will be used as primary. *The second wifi setting is optional
.. image:: images/wifi.png
:width: 200
:width: 300
:alt: Wifi page

View File

@ -3,6 +3,23 @@
Releases
########
v1.2.0 - beta1
==============
Features
++++++++
* Added support for the ESP32 C3 mini board
* Serial output is written to TX/RX pins instead of the USB connection for the ESP32c3. This way the serial console can be viewed when running on battery power.
Issues adressed
++++++++++++++++
* BUG: The first portion of a format template was lost when doing conversion.
Documentation
+++++++++++++
* Updated hardware section with options for ESP32 boards
* Updated installation instructions.
v1.1.1
======
* BUG: The text before the first variable was missed in the conversion of a format template.

View File

@ -1,4 +1,6 @@
{
"wifi-ssid": "ssid 1",
"wifi-ssid2": "ssid 2",
"mdns": "gravmon3",
"id": "7376ef",
"ota-url": "http://192.168.1.100:80/firmware/gravmon/",