22 Commits

Author SHA1 Message Date
3d4c04333e Added perf32 as target 2022-04-18 17:09:02 +02:00
2e3820ca73 GitHub Action Build 2022-04-09 12:09:24 +00:00
d52615f8e3 Update screendumps for 0.9 2022-04-09 14:05:18 +02:00
786b8e9b19 Update docs 2022-04-09 10:49:29 +02:00
10fa71d7ca GitHub Action Build 2022-04-09 07:09:20 +00:00
aeda821396 Fixed bad link to firmware upload 2022-04-09 09:05:28 +02:00
3db3968e07 GitHub Action Build 2022-04-09 07:00:17 +00:00
430f01943a Disable firmware upgrade if no file is selected 2022-04-09 08:56:59 +02:00
ca97a586c1 GitHub Action Build 2022-04-08 18:19:45 +00:00
5c80b780a0 Added check for valid SSID 2022-04-08 20:15:25 +02:00
2e42b86444 Updated hw docs for esp32 2022-04-08 20:14:57 +02:00
acb53bf611 Updated voltage factor for esp32 2022-04-08 20:07:23 +02:00
5b99304d7f GitHub Action Build 2022-04-07 18:40:31 +00:00
d94028a7b9 Updated docs 2022-04-07 20:37:35 +02:00
f4ca86e8ff Added link to firmware updata 2022-04-07 20:36:39 +02:00
2c9f5c72f2 GitHub Action Build 2022-04-07 14:56:20 +00:00
f5aae4f2ea Fixing temp adj in F correcly 2022-04-07 16:52:12 +02:00
51daa23327 GitHub Action Build 2022-04-06 18:21:08 +00:00
a5fb4f40b9 Merge branch 'dev' of https://github.com/mp-se/gravitymon into dev 2022-04-06 20:17:46 +02:00
17e9b0d51b added upgrade instructions 2022-04-06 20:17:26 +02:00
2877f91ef8 GitHub Action Build 2022-04-06 17:56:29 +00:00
8dd509214b Added git revision on UI 2022-04-06 19:52:56 +02:00
25 changed files with 174 additions and 87 deletions

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
run: pio run -e gravity-release -e gravity-perf -e gravity32-release -e gravity32-perf
- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version. https://github.com/marketplace/actions/add-commit
with:

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -445,6 +445,11 @@
</div>
</div>
</form>
<div class="form-group row">
<div class="col-sm-8 offset-sm-2">
<button class="btn btn-info" id="firmware-btn">Upload firmware</button>
</div>
</div>
</div>
</div>
</div>
@ -529,6 +534,10 @@ function checkHeader(input) {
} );
});
$("#firmware-btn").click(function(e){
window.location.href = "/firmware.htm";
});
// Open the format editor
$("#format-btn").click(function(e){
window.location.href = "/format.htm";

File diff suppressed because one or more lines are too long

View File

@ -21,6 +21,11 @@
</button>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="javascript:history.back()">Back to configuration</a>
</li>
</ul>
<div class="spinner-border text-light" id="spinner" role="status"></div>
</div>
</nav>
@ -80,7 +85,7 @@
-->
<form id="uploadForm" enctype="multipart/form-data">
<div class="col-md-8 custom-file">
<input type="file" accept=".bin" class="custom-file-input" name="name" id="name">
<input type="file" accept=".bin" class="custom-file-input" name="name" id="name" onchange="checkName()">
<label class="custom-file-label" for="name">Choose file</label>
</div>
<button type="submit" class="btn btn-primary" id="upload-btn" value="upload">Flash firmware</button>
@ -132,6 +137,10 @@
});
});
function checkName() {
setButtonDisabled( $("#name").val()!="" ? false : true );
}
function progressHandler(event) {
var percent = (event.loaded / event.total) * 100;
setProgress(Math.round(percent));
@ -141,7 +150,14 @@
$('.progress-bar').css('width', val+'%').attr('aria-valuenow', val).text(val + "%");
}
function setButtonDisabled( b ) {
$("#upload-btn").prop("disabled", b);
}
function getStatus() {
setButtonDisabled( true );
var url = "/api/status";
//var url = "/test/status.json";
$('#spinner').show();

View File

@ -1,4 +1,4 @@
<!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 rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous"><script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script></head><body class="py-4"><!-- START MENU --><nav class="navbar navbar-expand-sm navbar-dark bg-primary"><a class="navbar-brand" href="/firmware.htm">Beer Gravity Monitor - Firmware upgrade</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbar"><div class="spinner-border text-light" id="spinner" role="status"></div></div></nav><!-- START MAIN INDEX --><div class="container"><hr class="my-4"><div class="alert alert-success alert-dismissible fade hide show d-none" role="alert" id="alert"><div id="alert-msg">...</div><button type="button" id="alert-btn" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><script type="text/javascript">function showError(s){$(".alert").removeClass("alert-success").addClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}function showSuccess(s){$(".alert").addClass("alert-success").removeClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}$("#alert-btn").click(function(s){$(".alert").addClass("d-none").removeClass("show")})</script><div class="row mb-3"><div class="col-md-12 themed-grid-col bg-light">Here you can upload a new firmware version, it will not check the version number so you can also downgrade the firmware here.</div></div><div class="row mb-3"><div class="col-md-8 themed-grid-col bg-light">Current version:</div><div class="col-md-4 themed-grid-col bg-light" id="app-ver">Loading...</div></div><div class="row mb-3"><div class="col-md-8 themed-grid-col bg-light">Platform:</div><div class="col-md-4 themed-grid-col bg-light" id="platform">Loading...</div></div><div class="row mb-3"><!--
<!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 rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous"><script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script></head><body class="py-4"><!-- START MENU --><nav class="navbar navbar-expand-sm navbar-dark bg-primary"><a class="navbar-brand" href="/firmware.htm">Beer Gravity Monitor - Firmware upgrade</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbar"><ul class="navbar-nav mr-auto"><li class="nav-item"><a class="nav-link" href="javascript:history.back()">Back to configuration</a></li></ul><div class="spinner-border text-light" id="spinner" role="status"></div></div></nav><!-- START MAIN INDEX --><div class="container"><hr class="my-4"><div class="alert alert-success alert-dismissible fade hide show d-none" role="alert" id="alert"><div id="alert-msg">...</div><button type="button" id="alert-btn" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><script type="text/javascript">function showError(s){$(".alert").removeClass("alert-success").addClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}function showSuccess(s){$(".alert").addClass("alert-success").removeClass("alert-danger").removeClass("d-none").addClass("show"),$("#alert-msg").text(s)}$("#alert-btn").click(function(s){$(".alert").addClass("d-none").removeClass("show")})</script><div class="row mb-3"><div class="col-md-12 themed-grid-col bg-light">Here you can upload a new firmware version, it will not check the version number so you can also downgrade the firmware here.</div></div><div class="row mb-3"><div class="col-md-8 themed-grid-col bg-light">Current version:</div><div class="col-md-4 themed-grid-col bg-light" id="app-ver">Loading...</div></div><div class="row mb-3"><div class="col-md-8 themed-grid-col bg-light">Platform:</div><div class="col-md-4 themed-grid-col bg-light" id="platform">Loading...</div></div><div class="row mb-3"><!--
<form action="/api/upload" method="post" enctype="multipart/form-data">
<div class="col-md-8 custom-file">
<input type="file" accept=".bin" class="custom-file-input" name="name" id="name">
@ -6,7 +6,7 @@
</div>
<button type="submit" class="btn btn-primary" id="upload-btn" value="upload">Flash firmware</button>
</form>
--><form id="uploadForm" enctype="multipart/form-data"><div class="col-md-8 custom-file"><input type="file" accept=".bin" class="custom-file-input" name="name" id="name"> <label class="custom-file-label" for="name">Choose file</label></div><button type="submit" class="btn btn-primary" id="upload-btn" value="upload">Flash firmware</button></form></div><div class="progress"><div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div></div><hr class="my-4"></div><script type="text/javascript">window.onload = getStatus;
--><form id="uploadForm" enctype="multipart/form-data"><div class="col-md-8 custom-file"><input type="file" accept=".bin" class="custom-file-input" name="name" id="name" onchange="checkName()"> <label class="custom-file-label" for="name">Choose file</label></div><button type="submit" class="btn btn-primary" id="upload-btn" value="upload">Flash firmware</button></form></div><div class="progress"><div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div></div><hr class="my-4"></div><script type="text/javascript">window.onload = getStatus;
$(document).ready(function() {
$("#uploadForm").on('submit', function(e) {
@ -43,6 +43,10 @@
});
});
function checkName() {
setButtonDisabled( $("#name").val()!="" ? false : true );
}
function progressHandler(event) {
var percent = (event.loaded / event.total) * 100;
setProgress(Math.round(percent));
@ -52,7 +56,14 @@
$('.progress-bar').css('width', val+'%').attr('aria-valuenow', val).text(val + "%");
}
function setButtonDisabled( b ) {
$("#upload-btn").prop("disabled", b);
}
function getStatus() {
setButtonDisabled( true );
var url = "/api/status";
//var url = "/test/status.json";
$('#spinner').show();

View File

@ -173,7 +173,7 @@
console.log( cfg );
//$("#app-ver").text(cfg["app-ver"] + " (html 0.8.0)");
$("#app-ver").text(cfg["app-ver"]);
$("#app-ver").text(cfg["app-ver"] + " (" + cfg["app-build"] + ")");
$("#mdns").text(cfg["mdns"]);
$("#id").text(cfg["id"]);
$("#platform").text(cfg["platform"]);

File diff suppressed because one or more lines are too long

View File

@ -51,12 +51,6 @@ Config::Config() {
Log.verbose(F("CFG : Created config for %s (%s)." CR), _id.c_str(),
_mDNS.c_str());
#endif
#if defined(ESP8266)
setVoltageFactor(1.59); // Conversion factor for battery on ESP8266
#else // defined (ESP32)
setVoltageFactor(1.25); // Conversion factor for battery on ESP32
#endif
}
//

View File

@ -96,7 +96,7 @@ class Config {
String _mDNS = "";
String _otaURL = "";
char _tempFormat = 'C';
float _voltageFactor = 0;
float _voltageFactor = 1.59;
float _tempSensorAdjC = 0;
int _sleepInterval = 900;
bool _gyroTemp = false;
@ -322,12 +322,12 @@ class Config {
_tempSensorAdjC = f;
_saveNeeded = true;
}
void setTempSensorAdjC(String s) {
_tempSensorAdjC = s.toFloat();
void setTempSensorAdjC(String s, float adjustC = 0) {
_tempSensorAdjC = s.toFloat() + adjustC;
_saveNeeded = true;
}
void setTempSensorAdjF(String s) {
_tempSensorAdjC = convertFtoC(s.toFloat());
void setTempSensorAdjF(String s, float adjustF = 0) {
_tempSensorAdjC = convertFtoC(s.toFloat() + adjustF);
_saveNeeded = true;
}

View File

@ -64,6 +64,7 @@ SOFTWARE.
#define PARAM_FILE_NAME "file-name"
#define PARAM_FILE_SIZE "file-size"
#define PARAM_APP_VER "app-ver"
#define PARAM_APP_BUILD "app-build"
#define PARAM_ANGLE "angle"
#define PARAM_GRAVITY "gravity"
#define PARAM_TEMP_C "temp-c"

View File

@ -61,8 +61,9 @@ void WebServerHandler::webHandleConfig() {
// Format the adjustment so we get rid of rounding errors
if (myConfig.isTempF())
// We want the delta value (32F = 0C).
doc[PARAM_TEMP_ADJ] =
reduceFloatPrecision(convertCtoF(myConfig.getTempSensorAdjC()), 1);
reduceFloatPrecision(convertCtoF(myConfig.getTempSensorAdjC())-32, 1);
else
doc[PARAM_TEMP_ADJ] = reduceFloatPrecision(myConfig.getTempSensorAdjC(), 1);
@ -354,6 +355,7 @@ void WebServerHandler::webHandleStatus() {
doc[PARAM_TOKEN2] = myConfig.getToken2();
doc[PARAM_APP_VER] = CFG_APPVER;
doc[PARAM_APP_BUILD] = CFG_GITREV;
doc[PARAM_MDNS] = myConfig.getMDNS();
FloatHistoryLog runLog(RUNTIME_FILENAME);
@ -604,7 +606,8 @@ void WebServerHandler::webHandleConfigHardware() {
if (myConfig.isTempC()) {
myConfig.setTempSensorAdjC(_server->arg(PARAM_TEMP_ADJ));
} else {
myConfig.setTempSensorAdjF(_server->arg(PARAM_TEMP_ADJ));
// Data is delta so we add 32 in order to conver to C.
myConfig.setTempSensorAdjF(_server->arg(PARAM_TEMP_ADJ), 32);
}
}
if (_server->hasArg(PARAM_BLE))

View File

@ -89,8 +89,11 @@ bool WifiConnection::hasConfig() {
String ssid = WiFi.SSID();
if (ssid.length()) {
Log.notice(F("WIFI: Found credentials in EEPORM." CR));
myConfig.setWifiSSID(WiFi.SSID());
myConfig.setWifiSSID(ssid);
if (WiFi.psk().length())
myConfig.setWifiPass(WiFi.psk());
myConfig.saveFile();
return true;
}
@ -144,8 +147,13 @@ void WifiConnection::startPortal() {
if (myWifiManager->startConfigPortal(WIFI_DEFAULT_SSID, WIFI_DEFAULT_PWD)) {
Log.notice(F("WIFI: Exited portal, connected to wifi. Rebooting..." CR));
if (myWifiManager->getSSID().length())
myConfig.setWifiSSID(myWifiManager->getSSID());
if (myWifiManager->getPW().length())
myConfig.setWifiPass(myWifiManager->getPW());
myConfig.saveFile();
} else {
Log.notice(

View File

@ -22,6 +22,7 @@ URL: (http://gravmon.local)
:width: 800
:alt: Index page
Configuration is accessed by entering the URL for the device, this will be the mDNS name *device.local* or the IP adress. The following chapter assumes the device name is *gravmon*.
The main page shows the device readings; gravity, angle, temperature and battery charge. If the checkbox is active then the device will never go into sleep mode. This is useful if
@ -216,6 +217,7 @@ Gravity Settings
build this into the gravity formula.
.. warning::
This formula assumes that the calibration has been done at 20°C / 68°F.
Formula used in temperature correction.
@ -270,3 +272,12 @@ Hardware Settings
https://192.168.1.1/firmware/gravmon/
* **Upload Firmware**
This option gives you the possibility to install an new version of the firmware (or any firmware that uses the standard flash layout).
.. image:: images/firmware.png
:width: 600
:alt: Update firmware

View File

@ -16,6 +16,10 @@ I would suggest that you try how it fits into the PET tube before soldering it t
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -3,7 +3,7 @@
Installation
------------
You have these 3 options for flashing this firmware:
You have these 3 options for flashing this firmware.
* Brewflasher via USB serial
* Esptool via USB serial
@ -67,6 +67,32 @@ an option for updating firmware. The option is under the maintence meny.
Select the esp8266 version of the firmware called firmware.bin and press upload.
Updating firmware
=================
You can use the above options for updating the firmware as well. But if you want to do updates without connecting the USB cable these
are your options.
OTA Option
**********
You can use the OTA option by adding this URL to your configuration and when the device starts up in configuration mode it
will check for a new version and if it finds a newer version it will do an update.
``https://mp-se.github.io/gravitymon/release/``
Manual update
*************
When the device in is configuration mode you can manually update with a new firmware. Just open this URL in the web
browser and select the firmware.bin file that corresponds to the version you want to flash.
``http://<device_name>/firmware.htm``
.. _serial_monitoring:
Serial Monitoring
=================

View File

@ -18,12 +18,15 @@ v0.9.0
* Updated esp32 target with littlefs support
* Updated esp32 target with BLE send support (it will simulate a tilt)
* Mounted esp32 d1 mini mounted to a iSpindle PCB 4.0 (CherryPhilip) which worked fine.
* Documented hardware changes on esp32
* Default mDNS name is now shown on WIFI setup page.
* Added option to manually update/downgrade firmware under hardware settings.
* BUG: Corrected PIN for voltage read on ESP32
* BUG: If using plato and not gravity formula was defined the value was set to null.
* BUG: Temp format name was incorrect in iSpindle format causing receiver to incorrectly read temperature.
* BUG: Temperature sensor adjusmemnt value was not handled properly when using Farenheight.
* BUG: If the ID was to low the device id could end up with a leading space causing errors in data post. Added leading zero to ID.
* BUG: Entering wifi setup and a timeout occured the wifi settings could be deleted.
v0.8.0
------

View File

@ -11,6 +11,7 @@
"sleep-mode": false,
"rssi": -56,
"app-ver": "0.0.0",
"app-build": "gitrev",
"mdns": "gravmon",
"platform": "esp32",
"runtime-average": 3.12