Skip to content

Commit

Permalink
an attempt to fix ESP32-C6 build
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Oct 21, 2024
1 parent 3a46bc6 commit e858757
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 4 additions & 0 deletions software/firmware/source/SkyView/Platform_ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,12 @@ static void ESP32_setup()
}
#endif /* TBD */

#else
#if ARDUINO_USB_CDC_ON_BOOT && defined(CONFIG_IDF_TARGET_ESP32C6)
Serial.begin(SERIAL_OUT_BR);
#else
Serial.begin(SERIAL_OUT_BR, SERIAL_OUT_BITS);
#endif /* CONFIG_IDF_TARGET_ESP32C6 */
#endif /* ARDUINO_USB_CDC_ON_BOOT && (CONFIG_IDF_TARGET_ESP32S2 || S3) */
}

Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/SkyWatch/Platform_ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ static void ESP32_setup()
bool bma_present = false;
bool rtc_present = false;

#if defined(CONFIG_IDF_TARGET_ESP32)
Wire1.begin(SOC_GPIO_PIN_TWATCH_SEN_SDA , SOC_GPIO_PIN_TWATCH_SEN_SCL);
Wire1.beginTransmission(AXP202_SLAVE_ADDRESS);
axp_present = (Wire1.endTransmission() == 0);
Expand Down Expand Up @@ -386,6 +387,7 @@ static void ESP32_setup()
rtc = new PCF8563_Class(*i2c);
hw_info.rtc = RTC_PCF8563;
}
#endif /* CONFIG_IDF_TARGET_ESP32 */
}

#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6)
Expand Down
6 changes: 6 additions & 0 deletions software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ static void ESP32_setup()
hw_info.rtc = RTC_PCF8563;
hw_info.imu = ACC_BMA423;

#if defined(CONFIG_IDF_TARGET_ESP32)
Wire1.begin(SOC_GPIO_PIN_TWATCH_SEN_SDA , SOC_GPIO_PIN_TWATCH_SEN_SCL);
Wire1.beginTransmission(AXP202_SLAVE_ADDRESS);
bool has_axp202 = (Wire1.endTransmission() == 0);
Expand Down Expand Up @@ -740,9 +741,11 @@ static void ESP32_setup()
} else {
WIRE_FINI(Wire1);
}
#endif /* CONFIG_IDF_TARGET_ESP32 */
} else if (hw_info.model == SOFTRF_MODEL_PRIME_MK2) {
esp32_board = ESP32_TTGO_T_BEAM;

#if defined(CONFIG_IDF_TARGET_ESP32)
Wire1.begin(TTGO_V2_OLED_PIN_SDA , TTGO_V2_OLED_PIN_SCL);
Wire1.beginTransmission(AXP192_SLAVE_ADDRESS);
bool has_axp = (Wire1.endTransmission() == 0);
Expand Down Expand Up @@ -828,6 +831,7 @@ static void ESP32_setup()
hw_info.revision = 2;
}
}
#endif /* CONFIG_IDF_TARGET_ESP32 */
lmic_pins.rst = SOC_GPIO_PIN_TBEAM_RF_RST_V05;
lmic_pins.busy = SOC_GPIO_PIN_TBEAM_RF_BUSY_V08;
#if defined(CONFIG_IDF_TARGET_ESP32S2)
Expand Down Expand Up @@ -4354,7 +4358,9 @@ static bool ESP32_Baro_setup()
/* Try out OLED I2C bus */
Wire.begin(TTGO_V2_OLED_PIN_SDA, TTGO_V2_OLED_PIN_SCL);
if (hw_info.model == SOFTRF_MODEL_PRIME_MK2 && hw_info.revision >= 8) {
#if defined(CONFIG_IDF_TARGET_ESP32)
Wire1 = Wire;
#endif /* CONFIG_IDF_TARGET_ESP32 */
}
if (!Baro_probe()) {
if (!(hw_info.model == SOFTRF_MODEL_PRIME_MK2 && hw_info.revision >= 8)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@

////////////////////////////////////////

#elif (ESP32)
#elif defined(ESP32)

#if (_WIFI_LOGLEVEL_ > 2)
#warning Use ESP32 from WiFiWebServer
#endif

////////////////////////////////////////

#elif (ESP8266)
#elif defined(ESP8266)

#if (_WIFI_LOGLEVEL_ > 2)
#warning Use ESP8266 from WiFiWebServer
Expand Down Expand Up @@ -272,7 +272,7 @@

// KH, For PROGMEM commands
// ESP32/ESP8266 includes <pgmspace.h> by default, and memccpy_P was already defined there
#if !(ESP32 || ESP8266 || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4))
#if !(defined(ESP32) || defined(ESP8266) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4))
#include <avr/pgmspace.h>
#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n))
#endif
Expand Down Expand Up @@ -389,7 +389,7 @@ typedef struct

#include "utility/RequestHandler.h"

#if (ESP32 || ESP8266)
#if (defined(ESP32) || defined(ESP8266))
#include "FS.h"
#endif

Expand All @@ -400,7 +400,7 @@ class WiFiWebServer
{
public:

#if (ESP32 || ESP8266)
#if (defined(ESP32) || defined(ESP8266))
WiFiWebServer(IPAddress addr, int port = 80);
#endif

Expand Down Expand Up @@ -551,7 +551,7 @@ class WiFiWebServer

////////////////////////////////////////

#if !(ESP32 || ESP8266)
#if !(defined(ESP32) || defined(ESP8266))
template<typename T> size_t streamFile(T &file, const String& contentType)
{
using namespace mime;
Expand Down Expand Up @@ -607,7 +607,7 @@ class WiFiWebServer

////////////////////////////////////////

#if (ESP32 || ESP8266)
#if (defined(ESP32) || defined(ESP8266))
virtual size_t _currentClientWrite_P(PGM_P buffer, size_t length)
{
return _currentClient.write_P( buffer, length );
Expand Down Expand Up @@ -638,7 +638,7 @@ class WiFiWebServer
void _prepareHeader(WWString& response, int code, const char* content_type, size_t contentLength);
bool _collectHeader(const char* headerName, const char* headerValue);

#if (ESP32 || ESP8266)
#if (defined(ESP32) || defined(ESP8266))
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType, const int code = 200);

////////////////////////////////////////
Expand Down

0 comments on commit e858757

Please sign in to comment.