mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 04:36:38 +00:00
Add halGetChipModel
This commit is contained in:
parent
6fcbc27f83
commit
05b5c1fcf5
@ -1,6 +1,10 @@
|
|||||||
#include <ESP.h>
|
#include <ESP.h>
|
||||||
#include "hasp_hal.h"
|
#include "hasp_hal.h"
|
||||||
|
|
||||||
|
#if ESP32
|
||||||
|
#include "esp_system.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
#include <rom/rtc.h> // needed to get the ResetInfo
|
#include <rom/rtc.h> // needed to get the ResetInfo
|
||||||
|
|
||||||
@ -114,4 +118,39 @@ String halGetCoreVersion()
|
|||||||
#else
|
#else
|
||||||
return String(ESP.getCoreVersion());
|
return String(ESP.getCoreVersion());
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
String halGetChipModel()
|
||||||
|
{
|
||||||
|
String model((char *)0);
|
||||||
|
model.reserve(128);
|
||||||
|
|
||||||
|
#if ESP8266
|
||||||
|
model += F("ESP8266");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ESP32
|
||||||
|
esp_chip_info_t chip_info;
|
||||||
|
esp_chip_info(&chip_info);
|
||||||
|
|
||||||
|
model = chip_info.cores;
|
||||||
|
model += F("core ");
|
||||||
|
switch(chip_info.model) {
|
||||||
|
case CHIP_ESP32:
|
||||||
|
model += F("ESP32");
|
||||||
|
break;
|
||||||
|
#ifndef CHIP_ESP32S2
|
||||||
|
#define CHIP_ESP32S2 2
|
||||||
|
#endif
|
||||||
|
case CHIP_ESP32S2:
|
||||||
|
model += F("ESP32-S2");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
model = F("Unknown ESP");
|
||||||
|
}
|
||||||
|
model += F(" rev");
|
||||||
|
model += chip_info.revision;
|
||||||
|
#endif // ESP32
|
||||||
|
|
||||||
|
return model;
|
||||||
}
|
}
|
@ -7,5 +7,6 @@ uint8_t halGetHeapFragmentation(void);
|
|||||||
String halGetResetInfo(void);
|
String halGetResetInfo(void);
|
||||||
size_t halGetMaxFreeBlock(void);
|
size_t halGetMaxFreeBlock(void);
|
||||||
String halGetCoreVersion(void);
|
String halGetCoreVersion(void);
|
||||||
|
String halGetChipModel();
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user