Skip to content

Commit 1bfeefb

Browse files
committed
ThinkNode G3, ETH support WIP
1 parent 388c821 commit 1bfeefb

File tree

11 files changed

+102
-11
lines changed

11 files changed

+102
-11
lines changed

src/DebugConfiguration.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ extern MemGet memGet;
1313
#define LED_STATE_ON 1
1414
#endif
1515

16+
// WIFI LED
17+
#ifndef WIFI_STATE_ON
18+
#define WIFI_STATE_ON 1
19+
#endif
20+
1621
// -----------------------------------------------------------------------------
1722
// DEBUG
1823
// -----------------------------------------------------------------------------
@@ -147,7 +152,9 @@ extern "C" void logLegacy(const char *level, const char *fmt, ...);
147152
// Default Bluetooth PIN
148153
#define defaultBLEPin 123456
149154

150-
#if HAS_ETHERNET && !defined(USE_WS5500)
155+
#if HAS_ETHERNET && defined(USE_CH390D)
156+
#include <ESP32_CH390.h>
157+
#elif HAS_ETHERNET && !defined(USE_WS5500)
151158
#include <RAK13800_W5100S.h>
152159
#endif // HAS_ETHERNET
153160

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void setup()
323323

324324
#ifdef WIFI_LED
325325
pinMode(WIFI_LED, OUTPUT);
326-
digitalWrite(WIFI_LED, LOW);
326+
digitalWrite(WIFI_LED, HIGH ^ WIFI_STATE_ON);
327327
#endif
328328

329329
#ifdef BLE_LED

src/mesh/InterfacesTemplates.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ template class LR11x0Interface<LR1121>;
2525
template class SX126xInterface<STM32WLx>;
2626
#endif
2727

28-
#if HAS_ETHERNET && !defined(USE_WS5500)
28+
#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D)
2929
#include "api/ethServerAPI.h"
3030
template class ServerAPI<EthernetClient>;
3131
template class APIServerPort<ethServerAPI, EthernetServer>;

src/mesh/api/ethServerAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "configuration.h"
22
#include <Arduino.h>
33

4-
#if HAS_ETHERNET && !defined(USE_WS5500)
4+
#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D)
55

66
#include "ethServerAPI.h"
77

src/mesh/api/ethServerAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include "ServerAPI.h"
4-
#ifndef USE_WS5500
4+
#if !defined(USE_WS5500) && !defined(USE_CH390D)
55
#include <RAK13800_W5100S.h>
66

77
/**

src/mesh/wifi/WiFiAPClient.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,13 @@ static void WiFiEvent(WiFiEvent_t event)
354354
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
355355
LOG_INFO("Connected to access point");
356356
#ifdef WIFI_LED
357-
digitalWrite(WIFI_LED, HIGH);
357+
digitalWrite(WIFI_LED, LOW ^ WIFI_STATE_ON);
358358
#endif
359359
break;
360360
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
361361
LOG_INFO("Disconnected from WiFi access point");
362362
#ifdef WIFI_LED
363-
digitalWrite(WIFI_LED, LOW);
363+
digitalWrite(WIFI_LED, HIGH ^ WIFI_STATE_ON);
364364
#endif
365365
if (!isReconnecting) {
366366
WiFi.disconnect(false, true);
@@ -411,13 +411,13 @@ static void WiFiEvent(WiFiEvent_t event)
411411
case ARDUINO_EVENT_WIFI_AP_START:
412412
LOG_INFO("WiFi access point started");
413413
#ifdef WIFI_LED
414-
digitalWrite(WIFI_LED, HIGH);
414+
digitalWrite(WIFI_LED, LOW ^ WIFI_STATE_ON);
415415
#endif
416416
break;
417417
case ARDUINO_EVENT_WIFI_AP_STOP:
418418
LOG_INFO("WiFi access point stopped");
419419
#ifdef WIFI_LED
420-
digitalWrite(WIFI_LED, LOW);
420+
digitalWrite(WIFI_LED, HIGH ^ WIFI_STATE_ON);
421421
#endif
422422
break;
423423
case ARDUINO_EVENT_WIFI_AP_STACONNECTED:

src/modules/AdminModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
11801180
}
11811181
#endif
11821182

1183-
#if HAS_ETHERNET && !defined(USE_WS5500)
1183+
#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D)
11841184
conn.has_ethernet = true;
11851185
conn.ethernet.has_status = true;
11861186
if (Ethernet.linkStatus() == LinkON) {

src/mqtt/MQTT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <WiFiClientSecure.h>
1616
#endif
1717
#endif
18-
#if HAS_ETHERNET && !defined(USE_WS5500)
18+
#if HAS_ETHERNET && !defined(USE_WS5500) && !defined(USE_CH390D)
1919
#include <EthernetClient.h>
2020
#endif
2121

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x303a
7+
#define USB_PID 0x1001
8+
9+
// The default Wire will be mapped to PMU and RTC
10+
static const uint8_t SDA = 17;
11+
static const uint8_t SCL = 18;
12+
13+
// Default SPI will be mapped to Radio
14+
static const uint8_t SS = 39;
15+
static const uint8_t MOSI = 40;
16+
static const uint8_t MISO = 41;
17+
static const uint8_t SCK = 42;
18+
19+
// #define SPI_MOSI (11)
20+
// #define SPI_SCK (10)
21+
// #define SPI_MISO (9)
22+
// #define SPI_CS (12)
23+
24+
// #define SDCARD_CS SPI_CS
25+
26+
#endif /* Pins_Arduino_h */
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[env:thinknode_g3]
2+
extends = esp32s3_base
3+
board = ESP32-S3-WROOM-1-N4
4+
board_build.psram_type = opi
5+
6+
build_flags =
7+
${esp32s3_base.build_flags}
8+
-D ELECROW_ThinkNode_G3
9+
-D HAS_UDP_MULTICAST=1
10+
-D BOARD_HAS_PSRAM
11+
-D PRIVATE_HW
12+
# -D CONFIG_ETH_ENABLED=1
13+
# -D CONFIG_ETH_USE_ESP32_EMAC=1
14+
-I variants/esp32s3/ELECROW-ThinkNode-G3
15+
-mfix-esp32-psram-cache-issue
16+
17+
lib_ignore =
18+
Ethernet
19+
20+
lib_deps =
21+
${esp32s3_base.lib_deps}
22+
# file://../ESP32-CH390/ESP32-CH390-1.0.1.tar.gz

0 commit comments

Comments
 (0)