Skip to content

Commit 565a69e

Browse files
committed
0.8.142
* fix compile for ESP8266
1 parent e64f223 commit 565a69e

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/publisher/pubMqtt.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ class PubMqtt {
158158
publish(subtopics[MQTT_UPTIME], mVal.data());
159159
publish(subtopics[MQTT_RSSI], String(WiFi.RSSI()).c_str());
160160
publish(subtopics[MQTT_FREE_HEAP], String(ESP.getFreeHeap()).c_str());
161+
#if defined(ESP32)
161162
publish(subtopics[MQTT_TEMP_SENS_C], String(ah::readTemperature()).c_str());
162-
#ifndef ESP32
163+
#else ESP32
163164
publish(subtopics[MQTT_HEAP_FRAG], String(ESP.getHeapFragmentation()).c_str());
164165
#endif
165166
}

src/utils/helper.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ namespace ah {
142142
}
143143
DBGPRINTLN("");
144144
}
145+
145146
float readTemperature() {
146147
/*// ADC1 channel 0 is GPIO36
147148
adc1_config_width(ADC_WIDTH_BIT_12);
@@ -155,6 +156,10 @@ namespace ah {
155156
// This formula is an approximation and might need to be calibrated for your specific use case.
156157
float temperature = (voltage - 500) / 10.0;*/
157158

159+
#if defined(ESP_32)
158160
return temperatureRead();
161+
#else
162+
return 0;
163+
#endif
159164
}
160165
}

src/web/RestApi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,9 @@ class RestApi {
822822
void getChipInfo(JsonObject obj) {
823823
obj[F("cpu_freq")] = ESP.getCpuFreqMHz();
824824
obj[F("sdk")] = ESP.getSdkVersion();
825-
obj[F("temp_sensor_c")] = ah::readTemperature();
826825

827826
#if defined(ESP32)
827+
obj[F("temp_sensor_c")] = ah::readTemperature();
828828
obj[F("revision")] = ESP.getChipRevision();
829829
obj[F("model")] = ESP.getChipModel();
830830
obj[F("cores")] = ESP.getChipCores();

src/web/html/system.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@
4444
tr("{#ENVIRONMENT}", obj.generic.env + " ({#BUILD_OPTIONS}: " + obj.generic.modules + ")"),
4545
tr("Version", obj.generic.version + " - " + obj.generic.build),
4646
tr("Chip", "CPU: " + obj.chip.cpu_freq + "MHz, " + obj.chip.cores + " Core(s)"),
47-
tr("Chip Model", obj.chip.model),
48-
tr("Chip temp.", obj.chip.temp_sensor_c + "°C"),
47+
tr("Chip Model", obj.chip.model)
48+
/*IF_ESP32*/
49+
,tr("Chip temp.", obj.chip.temp_sensor_c + "°C")
50+
/*ENDIF_ESP32*/
4951
]
5052

5153
document.getElementById("info").append(

0 commit comments

Comments
 (0)