[ESP32-S2] Further make ESP32-S2 compile (no WiFi yet)

This commit is contained in:
TD-er
2021-02-07 01:13:07 +01:00
parent 51f027835e
commit ba398d0944
6 changed files with 34 additions and 6 deletions
+5 -1
View File
@@ -103,14 +103,18 @@ namespace std
#define ARDUINO_ESP8266_RELEASE "2_4_0"
#define NODE_TYPE_ID NODE_TYPE_ID_ESP_EASY32_STD
#ifndef ESP32S2
#define ICACHE_RAM_ATTR IRAM_ATTR
#endif
#define FILE_CONFIG "/config.dat"
#define FILE_SECURITY "/security.dat"
#define FILE_NOTIFICATION "/notification.dat"
#define FILE_RULES "/rules1.txt"
#include <WiFi.h>
// #include "esp32_ping.h"
#ifndef ESP32S2
#ifdef ESP32S2
#include <esp32s2/rom/rtc.h>
#else
#include <rom/rtc.h>
#endif
#include "esp_wifi.h" // Needed to call ESP-IDF functions like esp_wifi_....
+7 -1
View File
@@ -53,7 +53,13 @@ void setUseStaticIP(bool enabled) {
static bool ignoreDisconnectEvent = false;
void WiFiEvent(system_event_id_t event, system_event_info_t info) {
//#ifdef ESP32S2
//void WiFiEvent_cb(arduino_event_id_t event, arduino_event_info_t info)
//#else
void WiFiEvent_cb(system_event_id_t event, system_event_info_t info)
{
switch (event) {
case SYSTEM_EVENT_STA_CONNECTED:
{
+6 -1
View File
@@ -39,7 +39,12 @@ void setUseStaticIP(bool enabled);
// Make sure not to call anything in these functions that result in delay() or yield()
// ********************************************************************************
#ifdef ESP32
void WiFiEvent(system_event_id_t event, system_event_info_t info);
//#ifdef ESP32S2
//void WiFiEvent_cb(arduino_event_id_t event, arduino_event_info_t info);
//#else
void WiFiEvent_cb(system_event_id_t event, system_event_info_t info);
//#endif
#endif
+3 -1
View File
@@ -379,7 +379,9 @@ void initWiFi()
setWifiMode(WIFI_OFF);
#if defined(ESP32)
WiFiEventData.wm_event_id = WiFi.onEvent(WiFiEvent);
#ifndef ESP32S2
WiFiEventData.wm_event_id = WiFi.onEvent(WiFiEvent_cb);
#endif
#endif
#ifdef ESP8266
// WiFi event handlers
+8
View File
@@ -377,7 +377,9 @@ int espeasy_analogRead(int pin, bool readAsTouch) {
switch (adc) {
case 0:
#ifndef ESP32S2
value = hallRead();
#endif
break;
case 1:
canread = true;
@@ -492,6 +494,9 @@ uint8_t getChipCores() {
String getChipModel() {
#ifdef ESP32
#ifdef ESP32S2
return F("ESP32S2");
#else
{
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_ver = chip_ver & 0x7;
@@ -510,6 +515,7 @@ String getChipModel() {
break;
}
}
#endif
#elif defined(ESP8285)
return F("ESP8285");
#elif defined(ESP8266)
@@ -947,7 +953,9 @@ bool getADC_gpio_info(int gpio_pin, int& adc, int& ch, int& t)
int touchPinToGpio(int touch_pin)
{
switch (touch_pin) {
#ifndef ESP32S2
case 0: return T0;
#endif
case 1: return T1;
case 2: return T2;
case 3: return T3;
+5 -2
View File
@@ -51,8 +51,11 @@ String getLastBootCauseString() {
}
#ifdef ESP32
#include <rom/rtc.h>
#ifdef ESP32S2
#include <esp32s2/rom/rtc.h>
#else
#include <rom/rtc.h>
#endif
// See https://github.com/espressif/esp-idf/blob/master/components/esp32/include/rom/rtc.h
String getResetReasonString(byte icore) {