Skip to content

Commit 86befa1

Browse files
committed
legibility changes
1 parent ed04758 commit 86befa1

File tree

2 files changed

+27
-35
lines changed

2 files changed

+27
-35
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [v3.0.2] - 2025-03-14
6+
### Updated
7+
### Fixed
8+
- Edited firmware for legibility
9+
510
## [v3.0.1] - 2025-03-14
611
### Updated
712
- Tweaked display layouts

firmware/firmware.ino

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,16 @@
3232
#include <WiFi.h>
3333
#include <WebServer.h>
3434

35-
// ---------------------------------------------------------------------
36-
// WIFI CREDENTIALS - EDIT THESE
37-
// ---------------------------------------------------------------------
35+
36+
// WIFI CREDENTIALS - EDIT THESE
3837
const char* ssid = "YOUR_SSID";
3938
const char* password = "YOUR_PASSWORD";
4039

40+
4141
// Create the WebServer on port 80
4242
WebServer server(80);
4343

44-
// ---------------------------------------------------------------------
4544
// OLED SETUP
46-
// ---------------------------------------------------------------------
4745
#define SCREEN_WIDTH 128
4846
#define SCREEN_HEIGHT 64
4947
#define OLED_RESET -1 // Use -1 if no reset pin
@@ -53,25 +51,18 @@
5351
// Second OLED at address 0x3D (shows the graph/history)
5452
Adafruit_SSD1306 display2(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
5553

56-
// ---------------------------------------------------------------------
5754
// PINS
58-
// ---------------------------------------------------------------------
5955
#define POT_PIN 34 // ADC input from potentiometer (for live target temperature)
6056
#define ONE_WIRE_BUS 4 // DS18B20 data line (temperature sensor)
6157
#define HEATER_PIN 26 // Output to control MOSFET that switches the heater
6258
#define BUTTON_1 13 // Button used to toggle lock/unlock mode
6359
#define BUTTON_2 12 // Used to toggle auto mode
6460

65-
// ---------------------------------------------------------------------
6661
// DS18B20 SETUP
67-
// ---------------------------------------------------------------------
6862
OneWire oneWire(ONE_WIRE_BUS); // Initialize OneWire on the defined pin
6963
DallasTemperature sensors(&oneWire); // Pass OneWire to the DallasTemperature library
7064

71-
// ---------------------------------------------------------------------
7265
// 6-HOUR HISTORY (1080 points => 6hr, 1 every 20s)
73-
// We'll only show last 30 min = 90 points on OLED #2
74-
// ---------------------------------------------------------------------
7566
static const int HISTORY_LEN = 1080;
7667
static const int OLED_HISTORY_LEN = 90; // Last 30 minutes
7768

@@ -89,7 +80,6 @@
8980
// For button debouncing (to detect state changes)
9081
static bool lastButtonState = true;
9182

92-
// --- SHT30 object ---
9383
// Object for the SHT30 sensor that reads ambient temperature and humidity.
9484
Adafruit_SHT31 sht3x = Adafruit_SHT31();
9585

@@ -106,9 +96,8 @@
10696
bool enableWifi = false;
10797

10898

109-
// ---------------------------------------------------------------------
99+
110100
// Draw text center with a box on the OLED display
111-
// ---------------------------------------------------------------------
112101
void drawTextCenterWithBox(Adafruit_SSD1306 &disp, int16_t y, const char *text, uint8_t size)
113102
{
114103
disp.setTextSize(size);
@@ -126,9 +115,9 @@
126115
disp.print(text);
127116
}
128117

129-
// ---------------------------------------------------------------------
118+
119+
130120
// STAR FIELD (for splash animation)
131-
// ---------------------------------------------------------------------
132121
#define NUM_STARS 30
133122
static int starX[NUM_STARS]; // X coordinates for stars
134123
static int starY[NUM_STARS]; // Y coordinates for stars
@@ -144,7 +133,8 @@
144133
}
145134

146135

147-
// Draw star field and optional splash text on a display
136+
137+
// Draw star field and splash text on a display
148138
void drawStarsAndSplash(Adafruit_SSD1306 &disp, bool drawSplash, int offset)
149139
{
150140
disp.clearDisplay();
@@ -167,7 +157,9 @@
167157
}
168158
}
169159

170-
// A similar splash function for the second OLED with different text
160+
161+
162+
// Second OLED splash function
171163
void drawStarsAndSplash2(Adafruit_SSD1306 &disp, bool drawSplash, int offset)
172164
{
173165
disp.clearDisplay();
@@ -186,9 +178,9 @@
186178
}
187179
}
188180

189-
// ---------------------------------------------------------------------
181+
182+
190183
// GRAPH CONSTANTS (for OLED #2: graphing the last 30 min data)
191-
// ---------------------------------------------------------------------
192184
static const int GRAPH_LEFT = 20;
193185
static const int GRAPH_RIGHT = 127;
194186
static const int GRAPH_TOP = 9;
@@ -214,9 +206,9 @@
214206
return (int)(y + 0.5f);
215207
}
216208

217-
// ---------------------------------------------------------------------
209+
210+
218211
// WEB HANDLERS
219-
// ---------------------------------------------------------------------
220212

221213
// Handler to set the target temperature from the browser
222214
void handleSetTarget() {
@@ -237,7 +229,7 @@
237229
server.send(400, "text/plain", "Missing 'temp' parameter!");
238230
}
239231
}
240-
232+
241233
// Main webpage handler: Displays system status and sensor readings.
242234
void handleRoot()
243235
{
@@ -498,9 +490,8 @@
498490
}
499491

500492

501-
// ---------------------------------------------------------------------
493+
502494
// SETUP
503-
// ---------------------------------------------------------------------
504495
void setup()
505496
{
506497
Serial.begin(115200); // Start serial communication for debugging
@@ -515,9 +506,7 @@
515506
while(true);
516507
}
517508

518-
// ---------------
519509
// WiFi Selection
520-
// ---------------
521510
pinMode(BUTTON_1, INPUT_PULLUP);
522511
pinMode(BUTTON_2, INPUT_PULLUP);
523512

@@ -651,7 +640,6 @@
651640

652641
Wire.begin(); // Start I2C for OLEDs and SHT30
653642

654-
// --- NEW: SHT30 begin ---
655643
// Try to initialize the SHT30 sensor at its default address (0x44); if it fails, try 0x45.
656644
if(!sht3x.begin(0x44)) {
657645
Serial.println("SHT30 not found at 0x44? Trying 0x45...");
@@ -708,9 +696,9 @@
708696
Serial.println("ESP32 setup complete.");
709697
}
710698

711-
// ---------------------------------------------------------------------
699+
700+
712701
// LOOP
713-
// ---------------------------------------------------------------------
714702
void loop()
715703
{
716704
// Process any incoming web requests
@@ -764,6 +752,7 @@
764752
dewPointF = -999.0;
765753
}
766754

755+
767756
// --- AUTO MODE BUTTON HANDLING ---
768757
// Read the auto button state
769758
bool currentAutoButtonState = digitalRead(BUTTON_2);
@@ -811,10 +800,9 @@
811800
lastSampleTime = now;
812801
}
813802

814-
// -----------------------
803+
815804
// OLED #1: Display the target and current DS18B20 temperature,
816805
// plus the lock status, auto mode indicator, and heater state.
817-
// -----------------------
818806
display1.clearDisplay();
819807
// Draw a vertical divider between the left (target) and right (current) sections
820808
display1.drawLine(59, 0, 59, 33, WHITE);
@@ -866,9 +854,8 @@
866854
display1.display();
867855

868856

869-
// -----------------------
857+
870858
// OLED #2: Display the last 30 minutes of temperature history as a graph.
871-
// -----------------------
872859
display2.clearDisplay();
873860
display2.setTextSize(1);
874861
display2.setCursor(20, 0);

0 commit comments

Comments
 (0)