Skip to content

Commit

Permalink
Merge Old Devel (#54)
Browse files Browse the repository at this point in the history
* Update docs with metal tape collimator

* Framework update (#48)

* f719340 Reinstate TZ

* 8a46629 Support long longs in ArduinoJson

* f39229d Speed uploads

* cda685f Remove deprecated declaration

* 3316a14 Remove millis from uptime

* 6926790  Remove potential buffer overflow

* Add FS version

* Use new firmware names

* Remove whitespace

* Use main on LCBUrl

* Remove firmware
  • Loading branch information
lbussy committed Aug 19, 2023
1 parent 09e67d7 commit 4cab1c6
Show file tree
Hide file tree
Showing 42 changed files with 417 additions and 521 deletions.
2 changes: 1 addition & 1 deletion data/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function loadThisVersion() { // Get current parameters
})
.done(function (thisVersion) {
try {
$('#thisVersion').text("v" + thisVersion.version);
$('#thisVersion').text("v" + thisVersion.fw_version);
$('#thisBranch').text(thisVersion.branch);
$('#thisBuild').text(thisVersion.build);
}
Expand Down
2 changes: 1 addition & 1 deletion data/help.htm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h4 class="card-title">Brew Bubbles Support</h4>
other users on the <a href="http://support.brewbubbles.com/">HomeBrewTalk Thread</a>
</li>
<li><span class="fa-li"><i class="fas fa-chalkboard-teacher"></i></span>Discuss on
<a href="http://support.brewbubbles.com/">GitHub Discussions</a>
<a href="http://discuss.brewbubbles.com/">GitHub Discussions</a>
</li>
</ul>
</p>
Expand Down
28 changes: 20 additions & 8 deletions data/settings.htm
Original file line number Diff line number Diff line change
Expand Up @@ -545,24 +545,36 @@ <h4 class="card-title">Reset Controller</h4>
<h4 class="card-title">Update Firmware: Confirmation</h4>
</div>
<div class="card-body">
<p>
<table class="table table-hover">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Current</th>
<th scope="col">Available</th>
</tr>
</thead>
<tbody>
<tr class="table-success">
<th scope="row">Current Version:</th>
<tr class="table-firmware table-success">
<th scope="row">Firmware</th>
<td>
<div id="thisFWVersion">... loading</div>
</td>
<td>
<div id="thisVersion">... loading</div>
<div id="thatFWVersion">... loading</div>
</td>
</tr>
<tr class="table-info">
<th scope="row">Available version:</th>
<tr class="table-firmware table-info">
<th scope="row">Filesystem</th>
<td>
<div id="thatVersion">... loading</div>
<div id="thisFSVersion">... loading</div>
</td>
<td>
<div id="thatFSVersion">... loading</div>
</td>
</tr>
</tbody>
</table>
</p>

<p>
If you are sure you want to update firmware, click the button below.
</p>
Expand Down
18 changes: 12 additions & 6 deletions data/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,20 @@ function loadThisVersion() { // Get current parameters
})
.done(function (thisVersion) {
try {
$('#thisVersion').text(thisVersion.version);
$('#thisFWVersion').text(thisVersion.fw_version);
$('#thisFSVersion').text(thisVersion.fs_version);
}
catch {
if (!unloadingState) {
$('#thisVersion').text("Error parsing.");
$('#thisFWVersion').text("Error parsing.");
$('#thisFSVersion').text("Error parsing.");
}
}
})
.fail(function () {
if (!unloadingState) {
$('#thisVersion').text("Error loading.");
$('#thisFWVersion').text("Error loading.");
$('#thisFSVersion').text("Error loading.");
}
})
.always(function () {
Expand All @@ -129,18 +132,21 @@ function loadThatVersion() { // Get current parameters
})
.done(function (thatVersion) {
try {
$('#thatVersion').text(thatVersion.version);
$('#thatFWVersion').text(thatVersion.fw_version);
$('#thatFSVersion').text(thatVersion.fs_version);
document.getElementById("proceed").disabled = false;
}
catch {
if (!unloadingState) {
$('#thatVersion').text("Error parsing.");
$('#thatFWVersion').text("Error parsing.");
$('#thatFSVersion').text("Error parsing.");
}
}
})
.fail(function () {
if (!unloadingState) {
$('#thatVersion').text("Error loading.");
$('#thatFWVersion').text("Error loading.");
$('#thatFSVersion').text("Error loading.");
}
})
.always(function () {
Expand Down
5 changes: 5 additions & 0 deletions data/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "2.2.3",
"fs_version": "2.2.3",
"fw_version": "2.2.3"
}
13 changes: 11 additions & 2 deletions docs/assembly/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Displayed below is a view of the top of the printed circuit board, as rendered b
:scale: 90 %
:align: center
:alt: Top view of printed circuit board

Below is a view of the bottom of the printed circuit board, as rendered by OSH Park.

.. figure:: Bottom.png
Expand Down Expand Up @@ -114,8 +114,10 @@ Light Filter

These widely-used sensors are everywhere. Using them for this application sometimes takes a little tweaking to make it perfect. When developing Brew Bubbles, I got lucky and ended up with a couple of sensors that worked perfectly out of the box. After release, I discovered that most people were not so fortunate. Because the airlocks and water are clear, these other sensors failed to register bubbles correctly.

The Sharp GP1A57HRJ00Fit emits 950 nm light, and the receptor is sensitive to 400 through 1200 nm. That ranges from blue/violet through infrared. The sensor is most sensitive to IR light (700 nm – 1 mm) at 900 nm. Water absorbs infrared far better than the lower visible wavelengths:
The Sharp GP1A57HRJ00Fit emits 950 nm light, and the receptor is sensitive to 400 through 1200 nm. That ranges from blue/violet through infrared. This means that while the LED emits and the sensor senses infrared, it also will happily detect ambient light. When that happens, the water in the airlock will not block the sensor sufficiently.

The sensor is most sensitive to IR light (700 nm ΓÇô 1 mm) at 900 nm. Water absorbs infrared far better than the lower visible wavelengths:

.. figure:: water_absorption.gif
:scale: 75 %
:align: center
Expand All @@ -141,6 +143,13 @@ And here, wd16261 uses a piece of shrink-tubing with a dot of glue to hold his p

Both of these form collimators that restrict the amount of light entering the sensor. Both seem to be very effective and likely simpler than messing with light filters.

Subsequently, @gshadel on Homebrewtalk came up with something which may be even easier. He used aluminized HVAC duct tape (not the cloth kind) and a sewing pin to create a collimator with what seem to be excellent results. The self-adhesive properties and thinness make this an attractive solution.

.. figure:: sensor-tape.jpg
:scale: 15 %
:align: center
:alt: HVAC tape pinhole collimator

Bracket and Mounting
--------------------

Expand Down
Binary file added docs/assembly/sensor-tape.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
[common_env_data]
framework = arduino
platform = espressif8266
upload_speed = 460800 ; 921600 // MacBook can't handle the heat!
upload_speed = 921600
monitor_speed = 74880
monitor_filters =
; esp8266_exception_decoder
; log2file
build_unflags =
build_flags =
!python tools/git_rev.py
-D PIO_SRC_TAG=2.2.3
-D BAUD=${common_env_data.monitor_speed}
; -D DEBUG_ESP_PORT=Serial
; -D DEBUG_ESP_WIFI
Expand All @@ -37,9 +36,9 @@ build_flags =
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY ; v2 IPv6 Lower Memory
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH ; v2 IPv6 Higher Bandwidth
-D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; v1.4 Higher Bandwidth (Needed because of stream errors getting Filesystem OTA)
extra_scripts = ; pre:python tools\name_firmware.py
extra_scripts = pre:tools/inject_board.py
lib_deps =
ArduinoJson
bblanchon/ArduinoJson
https://github.com/lbussy/OneWire.git
https://github.com/lbussy/DS18B20.git
https://github.com/lbussy/Arduino-Log.git
Expand Down
1 change: 1 addition & 0 deletions src/brewersfriend.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SOFTWARE. */
#ifndef _BFTARGET_H
#define _BFTARGET_H

#include "config.h"
#include "pushtarget.h"
#include "pushhelper.h"
#include "jsonconfig.h"
Expand Down
1 change: 1 addition & 0 deletions src/brewfather.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SOFTWARE. */
#ifndef _BREWFTARGET_H
#define _BREWFTARGET_H

#include "config.h"
#include "pushtarget.h"
#include "pushhelper.h"
#include "jsonconfig.h"
Expand Down
35 changes: 25 additions & 10 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ SOFTWARE. */
#ifndef CONFIG_H
#define CONFIG_H

//////////////////////////////////////////////////////////////////////////
//
// Allow ArduinoJson to support 64-bit numbers
//
#ifndef ARDUINOJSON_USE_LONG_LONG
#define ARDUINOJSON_USE_LONG_LONG 1
#endif
//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//
// Set verbosity of debug messages 0-6
Expand Down Expand Up @@ -214,30 +224,35 @@ SOFTWARE. */

//////////////////////////////////////////////////////////////////////////
//
// Set Version JSON location
// File name for configuration JSON
//
#ifndef VERSIONJSONLOC
#define VERSIONJSONLOC "http://www.brewbubbles.com/firmware/version.json"
#ifndef CONFIGJSON
#define CONFIGJSON "/config.json"
#endif
//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//
// Firmware URL
// File name for version JSON
//
#ifndef FIRMWAREURL
#define FIRMWAREURL "http://www.brewbubbles.com/firmware/firmware.bin"
#ifndef VERSIONJSON
#define VERSIONJSON "/version.json"
#endif
//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//
// LittleFS URL
// Upgrade URL
//
#ifndef LITTLEFSURL
#define LITTLEFSURL "http://www.brewbubbles.com/firmware/littlefs.bin"
#ifndef UPGRADEURL
// #define DOBETA // Comment out for prod code
#ifdef DOBETA
#define UPGRADEURL "http://firmware.brewbubbles.com/testing"
#else
#define UPGRADEURL "http://firmware.brewbubbles.com"
#endif
#endif
//
//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -428,7 +443,7 @@ SOFTWARE. */
//
#ifndef TIMESERVER
#define TIMESERVER "pool.ntp.org", "time.nist.gov"
// #define THISTZ TZ_Etc_GMT
#define THISTZ TZ_Etc_GMT
#endif
//
//////////////////////////////////////////////////////////////////////////
Expand Down
25 changes: 19 additions & 6 deletions src/execota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SOFTWARE. */
#include "execota.h"

#if LWIP_VERSION_MAJOR == 2
#warning "Remember: You are using lwIP v2.x and this causes filesystem OTA tp act weird."
#warning "Remember: You are using lwIP v2.x and this causes filesystem OTA to act weird."
#endif

void execfw()
Expand All @@ -40,12 +40,20 @@ void execfw()
saveConfig();

ESPhttpUpdate.setLedPin(LED, LOW);
// "http://www.brewbubbles.com/firmware/firmware.bin"
WiFiClient _client;
Log.verbose(F("Pulling Firmware from: %s" CR), F(FIRMWAREURL));
char url[128];
#ifdef DOBETA
strcpy(url, UPGRADEURL);
#else
strcpy(url, UPGRADEURL);
#endif
strcat(url, "/");
strcat(url, board());
strcat(url, "_firmware.bin");
Log.verbose(F("Pulling Firmware from: %s" CR), url);
config.nodrd = true;
saveConfig();
t_httpUpdate_return ret = ESPhttpUpdate.update(_client, F(FIRMWAREURL), "0");
t_httpUpdate_return ret = ESPhttpUpdate.update(_client, url, "0");

switch (ret)
{
Expand Down Expand Up @@ -108,8 +116,13 @@ void execspiffs()
ESPhttpUpdate.setLedPin(LED, LOW);
// "http://www.brewbubbles.com/firmware/spiffs.bin"
WiFiClient client;
Log.verbose(F("Pulling Filesystem from: %s" CR), F(LITTLEFSURL));
t_httpUpdate_return ret = ESPhttpUpdate.updateFS(client, F(LITTLEFSURL), "");
char url[128];
strcpy(url, UPGRADEURL);
strcat(url, "/");
strcat(url, board());
strcat(url, "_littlefs.bin");
Log.verbose(F("Pulling Filesystem from: %s" CR), url);
t_httpUpdate_return ret = ESPhttpUpdate.updateFS(client, url, "");

switch (ret)
{
Expand Down
2 changes: 2 additions & 0 deletions src/execota.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ SOFTWARE. */
#ifndef _EXECOTA_H
#define _EXECOTA_H

#include "config.h"
#include "tools.h"
#include "jsonconfig.h"
#include "webserver.h"
#include "version.h"
#include <ESP8266WiFi.h>
#include <ESP8266httpUpdate.h>
#include <ArduinoLog.h>
Expand Down
4 changes: 2 additions & 2 deletions src/jsonconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SOFTWARE. */

#include "jsonconfig.h"

const char *filename = "/config.json";
const char *filename = CONFIGJSON;
Config config;

extern const size_t capacitySerial = 1536;
Expand Down Expand Up @@ -226,7 +226,7 @@ bool merge(JsonVariant dst, JsonVariantConst src)
{
if (src.is<JsonObject>())
{
for (auto kvp : src.as<JsonObject>())
for (auto kvp : src.as<JsonObjectConst>())
{
merge(dst.getOrAddMember(kvp.key()), kvp.value());
}
Expand Down
6 changes: 3 additions & 3 deletions src/jsonconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ bool loadFile();
bool saveFile();
bool printConfig();
bool printFile();
bool mergeJsonString(String newJson);
bool mergeJsonObject(JsonVariantConst src);
bool merge(JsonVariant dst, JsonVariantConst src);
bool serializeConfig(Print &);
bool deserializeConfig(Stream &);
bool merge(JsonVariant, JsonVariantConst);
bool mergeJsonObject(JsonVariantConst);
bool mergeJsonString(String);

#endif // _JSONCONFIG_H
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void setup()
if (bubbles.start()) // Initialize bubble counter
Log.notice(F("Bubble counter initialized." CR));

Log.notice(F("Started %s version %s (%s) [%s]." CR), API_KEY, version(), branch(), build());
Log.notice(F("Started %s version %s/%s (%s) [%s]." CR), API_KEY, fw_version(), fs_version(), branch(), build());
}

void loop()
Expand Down
2 changes: 1 addition & 1 deletion src/pincount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void interruptSetup()
attachInterrupt(digitalPinToInterrupt(COUNTPIN), handleInterrupt, RISING);
}

void ICACHE_RAM_ATTR handleInterrupt()
void IRAM_ATTR handleInterrupt()
{
pulse++;
blip = true;
Expand Down
2 changes: 1 addition & 1 deletion src/pincount.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ SOFTWARE. */
#include <Arduino.h>

void interruptSetup();
void ICACHE_RAM_ATTR handleInterrupt();
void IRAM_ATTR handleInterrupt();

#endif // _PINCOUNT_H
1 change: 1 addition & 0 deletions src/pushhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SOFTWARE. */
#ifndef _PUSHHELPER_H
#define _PUSHHELPER_H

#include "config.h"
#include "bubbles.h"
#include "pushtarget.h"
#include "target.h"
Expand Down

0 comments on commit 4cab1c6

Please sign in to comment.