Skip to content

Commit 72bfd26

Browse files
committed
Added c6 support
1 parent aa81b95 commit 72bfd26

15 files changed

Lines changed: 143 additions & 54 deletions

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
name: ESP32-C3
1818
- env: esp32s3
1919
name: ESP32-S3
20+
- env: esp32c6
21+
name: ESP32-C6
2022

2123
steps:
2224
- name: Check out code

.github/workflows/release.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ jobs:
4343
fwname: SomfyController.ino.esp32s3.bin
4444
fsname: SomfyController.littlefs.esp32s3.bin
4545
obname: SomfyController.onboard.esp32s3.bin
46+
- env: esp32c6
47+
name: ESP32-C6
48+
chip: ESP32-C6
49+
addr_bootloader: "0x0"
50+
addr_fs: "0x310000"
51+
fwname: SomfyController.ino.esp32c6.bin
52+
fsname: SomfyController.littlefs.esp32c6.bin
53+
obname: SomfyController.onboard.esp32c6.bin
4654

4755
steps:
4856
- name: Get Release

platformio.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,14 @@ board_build.partitions = esp32_3MB.csv
5353

5454
[env:esp32s3]
5555
board = esp32-s3-devkitc-1
56+
57+
[env:esp32c6]
58+
platform = https://github.com/mnowak32/platform-espressif32.git#boards/seeed_xiao_esp32c6
59+
platform_packages =
60+
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.4
61+
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.4/esp32-arduino-libs-3.0.4.zip
62+
board = seeed_xiao_esp32c6
63+
board_build.partitions = esp32_3MB.csv
64+
build_flags =
65+
${env.build_flags}
66+
-I${platformio.packages_dir}/framework-arduinoespressif32/libraries/Network/src

src/ConfigFile.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,9 @@ bool ShadeConfigFile::restoreFile(SomfyShadeController *s, const char *filename,
616616
if(opts.network) {
617617
settings.IP.save();
618618
settings.WIFI.save();
619+
#ifndef CONFIG_IDF_TARGET_ESP32C6
619620
settings.Ethernet.save();
621+
#endif
620622
}
621623
if(opts.mqtt) settings.MQTT.save();
622624
return true;
@@ -672,13 +674,15 @@ bool ShadeConfigFile::readNetRecord(restore_options_t &opts) {
672674
if(opts.network) {
673675
if(strncmp(settings.serverId, this->header.serverId, sizeof(settings.serverId)) == 0) {
674676
ESP_LOGI(TAG, "Restoring Ethernet adapter settings");
677+
#ifndef CONFIG_IDF_TARGET_ESP32C6
675678
settings.Ethernet.boardType = this->readUInt8(1);
676679
settings.Ethernet.phyType = static_cast<eth_phy_type_t>(this->readUInt8(0));
677680
settings.Ethernet.CLKMode = static_cast<eth_clock_mode_t>(this->readUInt8(0));
678681
settings.Ethernet.phyAddress = this->readInt8(1);
679682
settings.Ethernet.PWRPin = this->readInt8(1);
680683
settings.Ethernet.MDCPin = this->readInt8(16);
681684
settings.Ethernet.MDIOPin = this->readInt8(23);
685+
#endif
682686
}
683687
}
684688
if(this->file.position() != startPos + this->header.netRecordSize) {
@@ -1035,13 +1039,17 @@ bool ShadeConfigFile::writeNetRecord() {
10351039
this->writeBool(settings.MQTT.pubDisco);
10361040
this->writeVarString(settings.MQTT.rootTopic);
10371041
this->writeVarString(settings.MQTT.discoTopic);
1042+
#ifndef CONFIG_IDF_TARGET_ESP32C6
10381043
this->writeUInt8(settings.Ethernet.boardType);
10391044
this->writeUInt8(static_cast<uint8_t>(settings.Ethernet.phyType));
10401045
this->writeUInt8(static_cast<uint8_t>(settings.Ethernet.CLKMode));
10411046
this->writeInt8(settings.Ethernet.phyAddress);
10421047
this->writeInt8(settings.Ethernet.PWRPin);
10431048
this->writeInt8(settings.Ethernet.MDCPin);
10441049
this->writeInt8(settings.Ethernet.MDIOPin, CFG_REC_END);
1050+
#else
1051+
this->writeUInt8(0, CFG_REC_END);
1052+
#endif
10451053
return true;
10461054
}
10471055
bool ShadeConfigFile::writeTransRecord(transceiver_config_t &cfg) {

src/ConfigSettings.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,14 @@ bool ConfigSettings::begin() {
155155
case esp_chip_model_t::CHIP_ESP32S3:
156156
strcpy(this->chipModel, "s3");
157157
break;
158-
case esp_chip_model_t::CHIP_ESP32S2:
159-
strcpy(this->chipModel, "s2");
160-
break;
161158
case esp_chip_model_t::CHIP_ESP32C3:
162159
strcpy(this->chipModel, "c3");
163160
break;
164-
// case esp_chip_model_t::CHIP_ESP32C2:
165-
// strcpy(this->chipModel, "c2");
166-
// break;
167-
// case esp_chip_model_t::CHIP_ESP32C6:
168-
// strcpy(this->chipModel, "c6");
169-
// break;
170-
case esp_chip_model_t::CHIP_ESP32H2:
171-
strcpy(this->chipModel, "h2");
161+
#ifdef CHIP_ESP32C6
162+
case esp_chip_model_t::CHIP_ESP32C6:
163+
strcpy(this->chipModel, "c6");
172164
break;
165+
#endif
173166
default:
174167
sprintf(this->chipModel, "UNK%d", static_cast<int>(ci.model));
175168
break;
@@ -188,7 +181,9 @@ bool ConfigSettings::begin() {
188181
this->Security.begin();
189182
this->IP.begin();
190183
this->WIFI.begin();
184+
#ifndef CONFIG_IDF_TARGET_ESP32C6
191185
this->Ethernet.begin();
186+
#endif
192187
this->NTP.begin();
193188
this->MQTT.begin();
194189
this->print();
@@ -258,7 +253,9 @@ void ConfigSettings::print() {
258253
ESP_LOGD(TAG, "Connection Type: %u", (unsigned int) this->connType);
259254
this->NTP.print();
260255
if(this->connType == conn_types_t::wifi || this->connType == conn_types_t::unset) this->WIFI.print();
256+
#ifndef CONFIG_IDF_TARGET_ESP32C6
261257
if(this->connType == conn_types_t::ethernet || this->connType == conn_types_t::ethernetpref) this->Ethernet.print();
258+
#endif
262259
}
263260
void ConfigSettings::emitSockets() {}
264261
void ConfigSettings::emitSockets(uint8_t num) {}
@@ -590,6 +587,7 @@ bool WifiSettings::ssidExists(const char *ssid) {
590587
}
591588
return false;
592589
}
590+
#ifndef CONFIG_IDF_TARGET_ESP32C6
593591
EthernetSettings::EthernetSettings() {}
594592
bool EthernetSettings::begin() {
595593
this->load();
@@ -653,6 +651,7 @@ void EthernetSettings::print() {
653651
ESP_LOGD(TAG, "Ethernet Settings Board:%d PHYType:%d CLK:%d ADDR:%d PWR:%d MDC:%d MDIO:%d",
654652
this->boardType, this->phyType, this->CLKMode, this->phyAddress, this->PWRPin, this->MDCPin, this->MDIOPin);
655653
}
654+
#endif // CONFIG_IDF_TARGET_ESP32C6
656655
void ConfigSettings::printAvailHeap() {
657656
ESP_LOGD(TAG, "Max Heap: %u", (unsigned int)ESP.getMaxAllocHeap());
658657
ESP_LOGD(TAG, "Free Heap: %u", (unsigned int)ESP.getFreeHeap());

src/ConfigSettings.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <ArduinoJson.h>
2+
#ifndef CONFIG_IDF_TARGET_ESP32C6
23
#include <ETH.h>
4+
#endif
35
#ifndef configsettings_h
46
#define configsettings_h
57
#include "WResp.h"
@@ -88,6 +90,7 @@ class WifiSettings: BaseSettings {
8890
void print();
8991

9092
};
93+
#ifndef CONFIG_IDF_TARGET_ESP32C6
9194
class EthernetSettings: BaseSettings {
9295
public:
9396
EthernetSettings();
@@ -98,7 +101,7 @@ class EthernetSettings: BaseSettings {
98101
int8_t PWRPin = ETH_PHY_POWER;
99102
int8_t MDCPin = ETH_PHY_MDC;
100103
int8_t MDIOPin = ETH_PHY_MDIO;
101-
104+
102105
bool begin();
103106
bool fromJSON(JsonObject &obj);
104107
bool toJSON(JsonObject &obj);
@@ -108,6 +111,7 @@ class EthernetSettings: BaseSettings {
108111
void print();
109112
bool usesPin(uint8_t pin);
110113
};
114+
#endif
111115
class IPSettings: BaseSettings {
112116
public:
113117
IPSettings();
@@ -180,7 +184,9 @@ class ConfigSettings: BaseSettings {
180184
uint8_t status;
181185
IPSettings IP;
182186
WifiSettings WIFI;
187+
#ifndef CONFIG_IDF_TARGET_ESP32C6
183188
EthernetSettings Ethernet;
189+
#endif
184190
NTPSettings NTP;
185191
MQTTSettings MQTT;
186192
SecuritySettings Security;

0 commit comments

Comments
 (0)