Skip to content

Commit 75954a9

Browse files
committed
bump version number; add command to switch on/off display
1 parent 957f4de commit 75954a9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Topic: co2-meter/`{device ID}`/in/`{command}`
7070
| ---------- | ------------------------------------------------------------------------------------------ | -------------------- |
7171
| sleep | Start deep-sleep for specific duration (in seconds!) | { duration: number } |
7272
| info | Send info via MQTT topic `co2-meter/out/info` package | - |
73+
| display | turn display on/off | { on: boolean } |
7374
| hard-reset | Reset config with WiFi and MQTT settings and start internal hotspot to reconfigure device. | - |
7475

7576
### Outcoming commands

src/main.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern "C"
2424
#define DEVICE_ID (Sprintf("%06" PRIx64, ESP.getEfuseMac() >> 24)) // unique device ID
2525
#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
2626

27-
String version = "0.1.0";
27+
String version = "1.0.0";
2828

2929
AsyncMqttClient mqttClient;
3030

@@ -240,6 +240,13 @@ void processingMessage(String channel, DynamicJsonDocument doc)
240240
unsigned long seconds = doc["duration"].as<unsigned long>();
241241
goSleep(seconds);
242242
}
243+
else if (channel.equals("display"))
244+
{
245+
bool turnOn = doc["on"].as<bool>();
246+
uint8_t command = turnOn ? SSD1306_DISPLAYON : SSD1306_DISPLAYOFF;
247+
248+
display.ssd1306_command(command);
249+
}
243250
else if (channel.equals("hard-reset"))
244251
{
245252
hardReset();

0 commit comments

Comments
 (0)