Browse Source

output status

main
Hendrik Langer 7 years ago
parent
commit
0604e802c3
  1. 8
      src/main.cpp
  2. 1
      src/screen.cpp

8
src/main.cpp

@ -92,6 +92,12 @@ void setup() {
bme280Topic = "esp32-node/stat/" + iot.hostname + "/bme280"; bme280Topic = "esp32-node/stat/" + iot.hostname + "/bme280";
batteryTopic = "esp32-node/stat/" + iot.hostname + "/battery"; batteryTopic = "esp32-node/stat/" + iot.hostname + "/battery";
/*
//Use the web object to add elements to the interface
iot.web.addInterfaceElement("color", "input", "", "#configform", "LampColor");
iot.web.setInterfaceElementAttribute("color", "type", "text");
*/
esp_sleep_wakeup_cause_t wakeup_reason = esp_sleep_get_wakeup_cause(); esp_sleep_wakeup_cause_t wakeup_reason = esp_sleep_get_wakeup_cause();
switch(wakeup_reason) { switch(wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: case ESP_SLEEP_WAKEUP_EXT0:
@ -399,7 +405,7 @@ void loop()
strftime(timeStr, sizeof(timeStr), "%H:%M:%S", &timeinfo); strftime(timeStr, sizeof(timeStr), "%H:%M:%S", &timeinfo);
sprintf(weatherStr, "%.1f°C %.1f%% %.0fhPa", bme280.readTemperature(), bme280.readHumidity(), bme280.readPressure()); sprintf(weatherStr, "%.1f°C %.1f%% %.0fhPa", bme280.readTemperature(), bme280.readHumidity(), bme280.readPressure());
sprintf(statusStr, "%.1f°C %dmV %u %s", temperatureRead(), voltage, ESP.getFreeHeap()/1024, isAlarmActive()?"A":"_"); sprintf(statusStr, "%.1f %dmV %ddBm %ukB %s", temperatureRead(), voltage, WiFi.RSSI(), ESP.getFreeHeap()/1024, isAlarmActive()?"A":"_");
Serial.print("Free Heap: "); Serial.print("Free Heap: ");
Serial.println(ESP.getFreeHeap()); Serial.println(ESP.getFreeHeap());

1
src/screen.cpp

@ -256,6 +256,7 @@ void MainScreen::draw() {
u8g2.setFont(u8g2_font_profont12_mf); // choose a suitable font u8g2.setFont(u8g2_font_profont12_mf); // choose a suitable font
u8g2.drawUTF8(0, 30, weatherStr); u8g2.drawUTF8(0, 30, weatherStr);
u8g2.setFont(u8g2_font_profont10_mf); // choose a suitable font
u8g2.drawUTF8(0,42, statusStr); u8g2.drawUTF8(0,42, statusStr);
u8g2.setFont(u8g2_font_prospero_bold_nbp_tf); // choose a suitable font u8g2.setFont(u8g2_font_prospero_bold_nbp_tf); // choose a suitable font

Loading…
Cancel
Save