Skip to content

Commit 8423276

Browse files
authored
Merge pull request #116 from thorrak/arduino_v3
Bring v16 onto Arduino v3
2 parents 1a04f34 + 93a0343 commit 8423276

23 files changed

+168
-584
lines changed

4mb_no_ota.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000, 0x320000,
5+
spiffs, data, spiffs, 0x330000,0xD0000,

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ There are two versions of the ESP32 firmware - one supporting an LCD2004 I2C dis
5353

5454
### ESP8266
5555

56-
Although the ESP8266 was the original board chosen for this project, due to reduced support by the manufacturer its use in new builds is not recommended. For existing builds using the LoLin D1 Mini, the LoLin S2 Mini (utilizing the ESP32-S2) is recommended as a pin compatible replacement.
56+
Although the ESP8266 was the original board chosen for this project, due to reduced support by the manufacturer its use in new builds is not recommended, and future support by this firmware is not guaranteed. For existing builds using the LoLin D1 Mini, the LoLin S2 Mini (utilizing the ESP32-S2) is recommended as a pin compatible replacement.
5757

5858
* D0 - Heat
5959
* D1 - I2C SCL
@@ -72,6 +72,7 @@ Although the ESP8266 was the original board chosen for this project, due to redu
7272
* OTA (WiFi) connection to BrewPi
7373
* I2C LCD (20x4) Screen (/w Address Autodetection)
7474
* Tilt Hydrometer (as Temp Sensor) (ESP32 only)
75+
* Inkbird Bluetooth temperature sensors (ESP32 only)
7576
* TPLink Kasa WiFi Switches (ESP32 & ESP32-S2 WiFi only)
7677
* HTTP interface for quick updates
7778

@@ -94,4 +95,4 @@ Although this firmware works with brewpi-www, it is highly recommended that user
9495

9596
## Hardware
9697

97-
I maintain a separate repo with PCB and 3D-printable case designs for all of my projects. The page specific to BrewPi-ESP can be accessed [here](https://github.com/thorrak/thorrak_hardware/blob/master/BrewPi-ESP8266.md).
98+
I maintain a separate repo with PCB and 3D-printable case designs for all of my projects. It is available [here](https://github.com/thorrak/thorrak_hardware/).

data/404.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html class="h-full">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<script src="https://cdn.tailwindcss.com"></script>
6+
</head>
7+
<body class="h-full">
8+
<main class="grid min-h-full place-items-center bg-white px-6 py-24 sm:py-32 lg:px-8">
9+
<div class="text-center">
10+
<p class="text-base font-semibold text-indigo-600">404</p>
11+
<h1 class="mt-4 text-3xl font-bold tracking-tight text-gray-900 sm:text-5xl">Page not found</h1>
12+
<p class="mt-6 text-base leading-7 text-gray-600">Sorry, we couldn't find the page you're looking for.</p>
13+
<div class="mt-10 flex items-center justify-center gap-x-6">
14+
<a href="/" class="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Go back home</a>
15+
<!-- <a href="#" class="text-sm font-semibold text-gray-900">Contact support <span aria-hidden="true">&rarr;</span></a> -->
16+
</div>
17+
</div>
18+
</main>
19+
</body>
20+
</html>

data/index.css.gz

35 Bytes
Binary file not shown.

data/index.js.gz

11.2 KB
Binary file not shown.

docs/source/Solder Free BrewPi.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,38 @@ Although any ESP32 board can be used, and the screen/case are not mandatory, I f
1818

1919
### Other Components
2020

21-
* 1-2 x [Kasa Smart Plug](https://www.kasasmart.com/us/products/smart-plugs/kasa-smart-plug-mini-ep10) (Heat/Cool Switches)
22-
* 1 x [Inkbird IBS-TH2](https://www.amazon.com/Inkbird-Thermometer-Wireless-Bluetooth-Temperature/dp/B08S3CGZ3Q/) (Fridge Temp Sensor)
23-
* 1 x [Tilt Pro Hydrometer](https://tilthydrometer.com/products/tilt-pro-wireless-hydrometer-and-thermometer) (Beer Temp Sensor)
24-
* 1 x [Inkbird IBS-TH1 Plus](https://www.amazon.com/Inkbird-Bluetooth-Temperature-Thermometer-Hygrometer/dp/B07DQNFJVL/) (Beer Temp Sensor)
21+
#### Power Switches
2522

26-
You only need one of the Tilt Pro or Inkbird IBS-TH1 Plus to act as a beer temperature sensor -- The Tilt Pro is inserted directly into your beer and will measure the temperature floating on top, or you can use an Inkbird IBS-TH1 Plus which has a wired temperature sensor that can be snaked into a thermowell. Although regular, non-pro Tilts can be used, I do not recommend them as the thermometer only measures in whole-degree increments.
23+
For the solder-free build you will need **one or two** TPLink Kasa power switches, depending on if you want cooling support only, or both cooling and heating.
2724

28-
The EP10 Mini Kasa Smart Plug linked above supports loads up to 15A sustained, which should be sufficient for most heating/cooling setups -- please be sure not to overload the switch.
25+
* [Kasa Smart Plug EP10](https://www.kasasmart.com/us/products/smart-plugs/kasa-smart-plug-mini-ep10)
26+
* [Kasa Smart Plug HS103 or HS103P2](https://www.amazon.com/gp/product/B07B8W2KHZ/)
27+
* [Kasa Smart Outlet KP200](https://www.amazon.com/gp/product/B07N3CK3MM/)
28+
* [Kasa Smart Power Strip HS300](https://www.amazon.com/Kasa-Smart-Power-Strip-TP-Link/dp/B07G95FFN3/)
29+
30+
There are a number of Kasa plugs that will work, including form factors such as power strips, plug-in dongles, and outlets. You want the traditional WiFi outlets - not the Matter-compatible ones, or the "tapo" ones.
31+
32+
33+
#### Beer Sensors
34+
35+
Although not strictly required, without a beer sensor BrewPi functions similarly to a traditional thermostat. A beer sensor enables the use of the PID algorithm which leverages the fridge sensor to keep your beer within a range as tight as 0.1 F from the setpoint, as well as features like beer profile mode. The beer sensor needs to be able to sense the temperature of your _beer_, either through the use of a thermowell or by floating within it (in the case of the Tilt Hydrometer).
36+
37+
* [Tilt Pro Hydrometer](https://tilthydrometer.com/products/tilt-pro-wireless-hydrometer-and-thermometer)
38+
* [Inkbird IBS-TH1 Plus](https://www.amazon.com/Inkbird-Bluetooth-Temperature-Thermometer-Hygrometer/dp/B07DQNFJVL/) (Beer and Fridge)
39+
* [Inkbird IBS-TH2 Plus+T](https://www.amazon.com/Inkbird-Thermometer-Temperature-Humidity-Hygrometer/dp/B08TM67HJH/) (Beer and Fridge)
40+
41+
For the Inkbird IBS-TH1 Plus and IBS-TH2 Plus+T, there are two sensors on the device -- one "ambient" temperature sensor that measures the temperature at the device itself, and a second "probe" sensor. These can simultaneously act as the "beer" and "fridge" sensor if the device is mounted inside the fridge, as the ambient sensor can serve as the "fridge" sensor while the probe sensor serves as the "beer" sensor. If you decide to go this route, you do not need one of the fridge sensors listed below.
42+
43+
**PLEASE NOTE** - For the IBS-TH1 Plus and IBS-TH2 Plus Inkbird offers a "temperature only" probe which looks like a metal cap at the end of a wire, and a "temperatrue + humidity" probe that looks like a plastic grid at the end of a wire. You need the thinner "temperature only" probe.
44+
45+
46+
#### Fridge Sensors
47+
48+
The "fridge" sensor is required for the operation of a BrewPi device. This sensor measures the air temperature inside the fridge.
49+
50+
* [Inkbird IBS-TH1 Plus](https://www.amazon.com/Inkbird-Bluetooth-Temperature-Thermometer-Hygrometer/dp/B07DQNFJVL/) (Beer and Fridge)
51+
* [Inkbird IBS-TH2 Plus+T](https://www.amazon.com/Inkbird-Thermometer-Temperature-Humidity-Hygrometer/dp/B08TM67HJH/) (Beer and Fridge)
52+
* [Inkbird IBS-TH2](https://www.amazon.com/Inkbird-Thermometer-Wireless-Bluetooth-Temperature/dp/B08S3CGZ3Q/)
2953

3054

3155
## Instructions
@@ -36,10 +60,10 @@ Assembly/setup generally takes 10 minutes or less. To set up your controller, si
3660
2. Plug the LoLin TFT Screen into the D32 Pro using the LoLin TFT Cable
3761
3. If using the case, insert the screen/cable into the case, and secure the case lid to the case base using the appropriate screws
3862
4. Flash the BrewPi-ESP WiFi firmware to your D32 Pro using [these instructions](Installing%20the%20Firmware.md)
39-
5. Using a phone or other WiFi device, connect to the "BrewPiAP" WiFi network that your controller creates and connect it to your WiFi network
63+
5. Using a phone or other WiFi device, connect to the "BrewPiAP" WiFi network that your controller creates (password is "brewpiesp") and connect it to your WiFi network
4064
5. Connect the Kasa Smart Plug to the same WiFi network as your BrewPi by following the instructions included with the switches
4165
6. Using a phone or other WiFi device connected to the same WiFi network, log into the web interface by typing the IP address displayed in the lower left corner of the BrewPi screen into a web browser
42-
7. Click "Set Up Sensors/Actuators" and assign the appropriate functions to your Kasa switches, Inkbird temperature sensor, and Tilt hydrometer
43-
8. Connect your controller to your installation of [Fermentrack](http://www.fermentrack.com/) or [BrewPi Remix](http://www.brewpiremix.com/)
66+
7. Click "Set Up Sensors/Actuators" and assign the appropriate functions to your sensors and switches
67+
8. Connect your controller to your installation of [Fermentrack](http://www.fermentrack.com/), [Fermentrack.net](https://www.fermentrack.net/), or [BrewPi Remix](http://www.brewpiremix.com/)
4468

4569
Enjoy your new BrewPi temperature controller!

platformio.ini

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ default_envs = esp32_wifi_tft
1616
framework = arduino
1717
; The default platform & platform package only applies to ESP32 derivatives
1818
platform = espressif32
19-
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14
19+
platform_packages =
20+
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.4
21+
platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
2022
lib_deps =
21-
https://github.com/tzapu/WiFiManager.git#0d84861270c3cd64f72a4eaf34443ee580d2547e ; Anchor to latest commit as of 1/26/24
23+
https://github.com/tzapu/WiFiManager.git#0d84861270c3cd64f72a4eaf34443ee580d2547e ; Anchor to latest commit as of 8/7/24
2224
pstolarz/OneWireNg@^0.13.1
2325
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#ba26a1f1ee74dc875d3cc8fdb2ea1f55ee5ee333 ; Anchor to latest commit as of 1/26/24
2426
bblanchon/ArduinoJson @ ^6.21.2
@@ -73,7 +75,7 @@ lib_deps =
7375
adafruit/Adafruit BusIO@^1.14.1
7476
upload_speed = ${common.upload_speed}
7577
monitor_speed = ${common.monitor_speed}
76-
board_build.partitions = 4mb_inc_ota.csv
78+
board_build.partitions = 4mb_no_ota.csv
7779
;board_build.filesystem = spiffs
7880
build_type = ${common.build_type}
7981
monitor_filters =
@@ -104,15 +106,15 @@ lib_deps =
104106
${common.lib_deps_bluetooth}
105107
upload_speed = ${common.upload_speed}
106108
monitor_speed = ${common.monitor_speed}
107-
board_build.partitions = 4mb_inc_ota.csv
109+
board_build.partitions = 4mb_no_ota.csv
108110
;board_build.filesystem = spiffs
109111
build_type = ${common.build_type}
110112
monitor_filters =
111113
esp32_exception_decoder
112114

113115
[env:esp8266_wifi]
114-
; The latest platform has a bug that causes SIGNIFICANT inconsistency in connecting to WiFi. Rolling back for now.
115-
platform = espressif8266@4.1.0
116+
; v4.1.0 was known to be more stable with WiFi - but trying 4.2.1 to see if the issues have been fixed
117+
platform = espressif8266@4.2.1
116118
board = d1_mini
117119
framework = ${common.framework}
118120
board_build.filesystem = littlefs
@@ -209,7 +211,7 @@ lib_deps =
209211
upload_speed = ${common.upload_speed}
210212
monitor_speed = ${common.monitor_speed}
211213
board_build.partitions = 4mb_inc_ota.csv
212-
;board_build.filesystem = spiffs
214+
board_build.filesystem = spiffs
213215
;board_build.filesystem = littlefs
214216
build_type = ${common.build_type}
215217
monitor_filters =
@@ -246,50 +248,50 @@ build_type = ${common.build_type}
246248
monitor_filters =
247249
esp32_exception_decoder
248250

249-
[env:esp32_wifi_espi]
250-
board = m5stick-c
251-
platform = ${common.platform}
252-
framework = ${common.framework}
253-
platform_packages = ${common.platform_packages}
254-
; board_build.arduino.upstream_packages = no
255-
; For esp32_wifi_tft we want to enable LCD support, TFT support, and WiFi support
256-
build_flags =
257-
${common.build_flags}
258-
-DBREWPI_LCD
259-
-DBREWPI_TFT
260-
-DBREWPI_TFT_ESPI
261-
-DHAS_AXP192
262-
-DESP8266_WiFi
263-
-DHAS_BLUETOOTH
264-
-DEXTERN_SENSOR_ACTUATOR_SUPPORT
265-
; -DENABLE_PROMETHEUS_SERVER
266-
-DENABLE_HTTP_INTERFACE
267-
-DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED
268-
-DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED
269-
-DCONFIG_BT_NIMBLE_PINNED_TO_CORE=1
270-
-DESP32_STOCK
271-
-DUSER_SETUP_LOADED=1
272-
-DST7789_DRIVER=1
273-
-DTFT_WIDTH=135
274-
-DTFT_HEIGHT=240
275-
-DCGRAM_OFFSET=1
276-
-DTFT_MISO=-1
277-
-DTFT_MOSI=15
278-
-DTFT_SCLK=13
279-
-DTFT_CS=5
280-
-DTFT_DC=23
281-
-DTFT_RST=18
282-
-DLOAD_GFXFF=1
283-
-DSMOOTH_FONT=1
251+
; [env:esp32_wifi_espi]
252+
; board = m5stick-c
253+
; platform = ${common.platform}
254+
; framework = ${common.framework}
255+
; platform_packages = ${common.platform_packages}
256+
; ; board_build.arduino.upstream_packages = no
257+
; ; For esp32_wifi_tft we want to enable LCD support, TFT support, and WiFi support
258+
; build_flags =
259+
; ${common.build_flags}
260+
; -DBREWPI_LCD
261+
; -DBREWPI_TFT
262+
; -DBREWPI_TFT_ESPI
263+
; -DHAS_AXP192
264+
; -DESP8266_WiFi
265+
; -DHAS_BLUETOOTH
266+
; -DEXTERN_SENSOR_ACTUATOR_SUPPORT
267+
; ; -DENABLE_PROMETHEUS_SERVER
268+
; -DENABLE_HTTP_INTERFACE
269+
; -DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED
270+
; -DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED
271+
; -DCONFIG_BT_NIMBLE_PINNED_TO_CORE=1
272+
; -DESP32_STOCK
273+
; -DUSER_SETUP_LOADED=1
274+
; -DST7789_DRIVER=1
275+
; -DTFT_WIDTH=135
276+
; -DTFT_HEIGHT=240
277+
; -DCGRAM_OFFSET=1
278+
; -DTFT_MISO=-1
279+
; -DTFT_MOSI=15
280+
; -DTFT_SCLK=13
281+
; -DTFT_CS=5
282+
; -DTFT_DC=23
283+
; -DTFT_RST=18
284+
; -DLOAD_GFXFF=1
285+
; -DSMOOTH_FONT=1
284286

285-
lib_deps =
286-
${common.lib_deps}
287-
${common.lib_deps_bluetooth}
288-
bodmer/TFT_eSPI @ 2.5.34 ; https://github.com/Bodmer/TFT_eSPI.git
289-
upload_speed = 1500000
290-
monitor_speed = ${common.monitor_speed}
291-
board_build.partitions = 4mb_inc_ota.csv
292-
;board_build.filesystem = spiffs
293-
build_type = ${common.build_type}
294-
monitor_filters =
295-
esp32_exception_decoder
287+
; lib_deps =
288+
; ${common.lib_deps}
289+
; ${common.lib_deps_bluetooth}
290+
; bodmer/TFT_eSPI @ 2.5.34 ; https://github.com/Bodmer/TFT_eSPI.git
291+
; upload_speed = 1500000
292+
; monitor_speed = ${common.monitor_speed}
293+
; board_build.partitions = 4mb_inc_ota.csv
294+
; ;board_build.filesystem = spiffs
295+
; build_type = ${common.build_type}
296+
; monitor_filters =
297+
; esp32_exception_decoder

src/CommandProcessor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,11 @@ void CommandProcessor::parseDeviceDefinition() {
305305
*
306306
* \ingroup commands
307307
*/
308-
void CommandProcessor::resetWiFi() { WiFi.disconnect(true); }
308+
void CommandProcessor::resetWiFi() {
309+
WiFi.disconnect(true);
310+
delay(500);
311+
handleReset();
312+
}
309313

310314
/**
311315
* \brief Get info about the WiFi connection

src/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355

356356

357357

358-
#define FIRMWARE_REVISION "v16-alpha1"
358+
#define FIRMWARE_REVISION "v16-alpha2"
359359

360360
#ifdef ESP8266_WiFi
361361
#define WIFI_SETUP_AP_NAME "BrewPiAP"

src/ESP_BP_WiFi.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,8 @@
2424

2525

2626
bool shouldSaveConfig = false;
27-
#ifndef ESP8266
28-
WiFiServerFixed server(23);
29-
WiFiClientFixed serverClient;
30-
#else
3127
WiFiServer server(23);
3228
WiFiClient serverClient;
33-
#endif
3429

3530
extern void handleReset(); // Terrible practice. In brewpi-esp8266.cpp.
3631

@@ -163,7 +158,7 @@ void initialize_wifi() {
163158
} else {
164159
// If the mDNS name is invalid, reset the WiFi configuration and restart the device
165160
WiFi.disconnect(true);
166-
delay(2000);
161+
delay(500);
167162
handleReset();
168163
}
169164
}
@@ -191,7 +186,7 @@ void wifi_connect_clients() {
191186
static unsigned long last_connection_check = 0;
192187

193188
yield();
194-
if(WiFi.isConnected()) {
189+
if(WiFi.status() == WL_CONNECTED) {
195190
// We only accept clients if we do not have a REST target defined
196191
if(rest_handler.configured_for_fermentrack_rest()) {
197192
// If we show a client as already being disconnected, force a disconnect
@@ -202,11 +197,7 @@ void wifi_connect_clients() {
202197
// We are handling serial connections, and have a client in queue to connect
203198
// If we show a client as already being disconnected, force a disconnect
204199
if (serverClient) serverClient.stop();
205-
#ifdef ESP8266
206200
serverClient = server.accept();
207-
#else
208-
serverClient = server.available();
209-
#endif
210201
serverClient.flush();
211202
}
212203
} else {
@@ -215,11 +206,7 @@ void wifi_connect_clients() {
215206
// we show a client as already being disconnected, force a disconnect
216207
if (serverClient) {
217208
serverClient.stop();
218-
#ifdef ESP8266
219209
serverClient = server.accept();
220-
#else
221-
serverClient = server.available();
222-
#endif
223210
serverClient.flush();
224211
}
225212
}
@@ -228,11 +215,10 @@ void wifi_connect_clients() {
228215
// Additionally, every 3 minutes either attempt to reconnect WiFi, or rebroadcast mdns info
229216
if(ticks.millis() - last_connection_check >= (3 * 60 * 1000)) {
230217
last_connection_check = ticks.millis();
231-
if(!WiFi.isConnected()) {
218+
if(WiFi.status() != WL_CONNECTED) {
232219
// If we are disconnected, reconnect. On an ESP8266 this will ALSO trigger mdns_reset due to the callback
233220
// but on the ESP32, this means that we'll have to wait an additional 3 minutes for mdns to come back up
234-
WiFi.disconnect();
235-
delay(50);
221+
delay(150);
236222
WiFi.begin();
237223
} else {
238224
// #defining this out for now as there is a memory leak caused by this

src/ESP_BP_WiFi.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22
#include <ArduinoJson.h>
3-
#include "WiFiClientFix.h"
4-
#include "WiFiServerFixed.h"
53

64
/**
75
* \file ESP_BP_WiFi.h
@@ -58,13 +56,8 @@ void initWifiServer();
5856
*/
5957
void wifi_connection_info(JsonDocument& doc);
6058

61-
#ifndef ESP8266
62-
extern WiFiServerFixed server;
63-
extern WiFiClientFixed serverClient;
64-
#else
6559
extern WiFiServer server;
6660
extern WiFiClient serverClient;
67-
#endif
6861

6962

7063

src/PiLink.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ template <typename StreamType> class PiLink : public PiStream<StreamType> {
7777
};
7878

7979
#if defined(ESP32S2)
80-
extern PiLink<std::conditional<Config::PiLink::useWifi, WiFiClientFixed, USBCDC>::type> piLink;
80+
extern PiLink<std::conditional<Config::PiLink::useWifi, WiFiClient, USBCDC>::type> piLink;
8181
#else
82-
#ifdef ESP8266
8382
extern PiLink<std::conditional<Config::PiLink::useWifi, WiFiClient, HardwareSerial>::type> piLink;
84-
#else
85-
// ESP32
86-
extern PiLink<std::conditional<Config::PiLink::useWifi, WiFiClientFixed, HardwareSerial>::type> piLink;
87-
#endif
8883
#endif

0 commit comments

Comments
 (0)