mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-02 11:45:54 +02:00
0.8.142
* fix compile for ESP8266
This commit is contained in:
parent
e64f22336c
commit
565a69e5c0
4 changed files with 12 additions and 4 deletions
|
@ -158,8 +158,9 @@ class PubMqtt {
|
||||||
publish(subtopics[MQTT_UPTIME], mVal.data());
|
publish(subtopics[MQTT_UPTIME], mVal.data());
|
||||||
publish(subtopics[MQTT_RSSI], String(WiFi.RSSI()).c_str());
|
publish(subtopics[MQTT_RSSI], String(WiFi.RSSI()).c_str());
|
||||||
publish(subtopics[MQTT_FREE_HEAP], String(ESP.getFreeHeap()).c_str());
|
publish(subtopics[MQTT_FREE_HEAP], String(ESP.getFreeHeap()).c_str());
|
||||||
|
#if defined(ESP32)
|
||||||
publish(subtopics[MQTT_TEMP_SENS_C], String(ah::readTemperature()).c_str());
|
publish(subtopics[MQTT_TEMP_SENS_C], String(ah::readTemperature()).c_str());
|
||||||
#ifndef ESP32
|
#else ESP32
|
||||||
publish(subtopics[MQTT_HEAP_FRAG], String(ESP.getHeapFragmentation()).c_str());
|
publish(subtopics[MQTT_HEAP_FRAG], String(ESP.getHeapFragmentation()).c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,7 @@ namespace ah {
|
||||||
}
|
}
|
||||||
DBGPRINTLN("");
|
DBGPRINTLN("");
|
||||||
}
|
}
|
||||||
|
|
||||||
float readTemperature() {
|
float readTemperature() {
|
||||||
/*// ADC1 channel 0 is GPIO36
|
/*// ADC1 channel 0 is GPIO36
|
||||||
adc1_config_width(ADC_WIDTH_BIT_12);
|
adc1_config_width(ADC_WIDTH_BIT_12);
|
||||||
|
@ -155,6 +156,10 @@ namespace ah {
|
||||||
// This formula is an approximation and might need to be calibrated for your specific use case.
|
// This formula is an approximation and might need to be calibrated for your specific use case.
|
||||||
float temperature = (voltage - 500) / 10.0;*/
|
float temperature = (voltage - 500) / 10.0;*/
|
||||||
|
|
||||||
|
#if defined(ESP_32)
|
||||||
return temperatureRead();
|
return temperatureRead();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -822,9 +822,9 @@ class RestApi {
|
||||||
void getChipInfo(JsonObject obj) {
|
void getChipInfo(JsonObject obj) {
|
||||||
obj[F("cpu_freq")] = ESP.getCpuFreqMHz();
|
obj[F("cpu_freq")] = ESP.getCpuFreqMHz();
|
||||||
obj[F("sdk")] = ESP.getSdkVersion();
|
obj[F("sdk")] = ESP.getSdkVersion();
|
||||||
obj[F("temp_sensor_c")] = ah::readTemperature();
|
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
|
obj[F("temp_sensor_c")] = ah::readTemperature();
|
||||||
obj[F("revision")] = ESP.getChipRevision();
|
obj[F("revision")] = ESP.getChipRevision();
|
||||||
obj[F("model")] = ESP.getChipModel();
|
obj[F("model")] = ESP.getChipModel();
|
||||||
obj[F("cores")] = ESP.getChipCores();
|
obj[F("cores")] = ESP.getChipCores();
|
||||||
|
|
|
@ -44,8 +44,10 @@
|
||||||
tr("{#ENVIRONMENT}", obj.generic.env + " ({#BUILD_OPTIONS}: " + obj.generic.modules + ")"),
|
tr("{#ENVIRONMENT}", obj.generic.env + " ({#BUILD_OPTIONS}: " + obj.generic.modules + ")"),
|
||||||
tr("Version", obj.generic.version + " - " + obj.generic.build),
|
tr("Version", obj.generic.version + " - " + obj.generic.build),
|
||||||
tr("Chip", "CPU: " + obj.chip.cpu_freq + "MHz, " + obj.chip.cores + " Core(s)"),
|
tr("Chip", "CPU: " + obj.chip.cpu_freq + "MHz, " + obj.chip.cores + " Core(s)"),
|
||||||
tr("Chip Model", obj.chip.model),
|
tr("Chip Model", obj.chip.model)
|
||||||
tr("Chip temp.", obj.chip.temp_sensor_c + "°C"),
|
/*IF_ESP32*/
|
||||||
|
,tr("Chip temp.", obj.chip.temp_sensor_c + "°C")
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
]
|
]
|
||||||
|
|
||||||
document.getElementById("info").append(
|
document.getElementById("info").append(
|
||||||
|
|
Loading…
Add table
Reference in a new issue