forked from xiaozhi/xiaozhi-esp32
add zhengchen_boards_wifi(征辰科技) (#635)
* add zhengchen_boards_wifi * add zhengchen_boards_wifi1
This commit is contained in:
29
main/boards/zhengchen-1.54tft-wifi/temperature.cc
Normal file
29
main/boards/zhengchen-1.54tft-wifi/temperature.cc
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "iot/thing.h"
|
||||
#include "board.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#define TAG "Temperature"
|
||||
|
||||
namespace iot {
|
||||
|
||||
class Temperature : public Thing {
|
||||
private:
|
||||
float esp32temp = 0.0f;
|
||||
public:
|
||||
Temperature() : Thing("Temperature", "芯片温度管理") {
|
||||
// 定义设备的属性
|
||||
properties_.AddNumberProperty("temp", "当前芯片温度", [this]() -> float {
|
||||
auto& board = Board::GetInstance();
|
||||
if (board.GetTemperature(esp32temp)) {
|
||||
return esp32temp;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace iot
|
||||
|
||||
DECLARE_THING(Temperature);
|
||||
Reference in New Issue
Block a user