Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Нова сумісність: ESP32-S3, ESP32-C3 #320

Merged
merged 31 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f953f2b
esp32s3 compatibility
v00g100skr Feb 4, 2025
19b3260
configs
v00g100skr Feb 4, 2025
9130b8f
configs fix
v00g100skr Feb 4, 2025
ae9e7f0
fastled pin map
v00g100skr Feb 4, 2025
d7c70a9
buils task
v00g100skr Feb 5, 2025
8911845
fix
v00g100skr Feb 5, 2025
81837fb
fix paths
v00g100skr Feb 5, 2025
2685571
added input for firmware-compile action
Foroxon Feb 6, 2025
9d94c57
moved Lite and Test builds to platformIO envs
Foroxon Feb 6, 2025
4d00f64
removed "defined"
v00g100skr Feb 6, 2025
181d292
Merge branch 'develop' into esp32s3
Foroxon Feb 6, 2025
961d1b5
esp32c3
v00g100skr Feb 6, 2025
0d91fab
moved all defines to platformio.ini
Foroxon Feb 8, 2025
61dbe86
flasher
v00g100skr Feb 8, 2025
53ca71d
Merge branch 'esp32s3' of https://github.com/J-A-A-M/ukraine_alarm_ma…
v00g100skr Feb 8, 2025
641dc58
flasher index.html fix
v00g100skr Feb 8, 2025
75d55c6
added board description to fw version
Foroxon Feb 8, 2025
1a0f347
fix manifest
v00g100skr Feb 8, 2025
7cc906d
manifest
v00g100skr Feb 8, 2025
8462cca
update impl for s3 and c3 chips
Foroxon Feb 8, 2025
6798c74
Merge branch 'develop' into esp32s3
Foroxon Feb 9, 2025
b31a790
Merge branch 'develop' into esp32s3
Foroxon Feb 10, 2025
732c254
fixed alternative boards checks
Foroxon Feb 10, 2025
eb6f9a3
simplified data mapping
Foroxon Feb 10, 2025
583ee27
removed Jaam 1.3 and Jaam 2.x options for s3 and c3 boards
Foroxon Feb 10, 2025
07abc6b
pin map
v00g100skr Feb 10, 2025
51f15e5
removed unused manifests
v00g100skr Feb 10, 2025
e4d3911
fixed issue with whitespaces
Foroxon Feb 10, 2025
b7c9e8b
Merge branch 'develop' into esp32s3
Foroxon Feb 10, 2025
130619d
added 'exception decoder' build type
Foroxon Feb 10, 2025
eaf1b1d
Merge branch 'develop' into esp32s3
Foroxon Feb 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
uses: ./.github/workflows/firmware-compile
with:
project-folder: firmware
project-env: firmware
- name: Copy bin file
run: |
cp -f ${{ github.workspace }}/firmware/.pio/build/firmware/firmware.bin ${{ github.workspace }}/firmware.bin
Expand All @@ -25,6 +26,23 @@
with:
name: firmware.bin
path: ${{ github.workspace }}/firmware.bin
compile_firmware_esp32s3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile firmware
uses: ./.github/workflows/firmware-compile
with:
project-folder: firmware
project-env: firmware_esp32s3
- name: Copy bin file
run: |
cp -f ${{ github.workspace }}/firmware/.pio/build/firmware_esp32s3/firmware.bin ${{ github.workspace }}/firmware-esp32s3.bin
- name: Upload firmware esp32s3
uses: actions/upload-artifact@v4
with:
name: firmware-esp32s3.bin
path: ${{ github.workspace }}/firmware-esp32s3.bin
compile_firmware_lite:
runs-on: ubuntu-latest
steps:
Expand All @@ -36,6 +54,7 @@
uses: ./.github/workflows/firmware-compile
with:
project-folder: firmware
project-env: firmware
- name: Copy bin file
run: |
cp -f ${{ github.workspace }}/firmware/.pio/build/firmware/firmware.bin ${{ github.workspace }}/firmware-lite.bin
Expand All @@ -56,6 +75,7 @@
uses: ./.github/workflows/firmware-compile
with:
project-folder: firmware
project-env: firmware
- name: Copy bin file
run: |
cp -f ${{ github.workspace }}/firmware/.pio/build/firmware/firmware.bin ${{ github.workspace }}/firmware-jaam2-test.bin
Expand All @@ -80,6 +100,7 @@
uses: ./.github/workflows/firmware-compile
with:
project-folder: updater
project-env: updater
- name: Copy bin file
run: |
cp -f ${{ github.workspace }}/updater/.pio/build/updater/firmware.bin ${{ github.workspace }}/updater.bin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/firmware-compile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ runs:
run: pip install --upgrade platformio
- name: Build ${{ inputs.project-folder }}
shell: bash
run: pio run -d ${{ inputs.project-folder }}
run: pio run -d ${{ inputs.project-folder }} -e ${{ inputs.project-env }}
Foroxon marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 15 additions & 5 deletions firmware/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:firmware]
[platformio]
default_envs = firmware

[common]
platform = espressif32@6.9.0
board = esp32dev
framework = arduino
monitor_speed = 115200
board_build.partitions = min_spiffs.csv
# uncomment the following line to enable crash backtrace
; monitor_filters = esp32_exception_decoder
lib_deps =
https://github.com/MatheusAlvesA/ArduinoAsync.git
adafruit/Adafruit SSD1306@2.5.13
Expand All @@ -30,6 +30,16 @@ lib_deps =
sensirion/arduino-sht@1.2.6
soylentorange/forcedBMX280@1.1.1
dawidchyrzynski/home-assistant-integration@2.1.0
https://github.com/J-A-A-M/melody-player.git@2.4.0
https://github.com/J-A-A-M/melody-player.git@2.4.0
yasheena/TelnetSpy@1.4
mathertel/OneButton@2.6.1

[env:firmware]
extends = common
board = esp32dev
build_flags = -D BOARD_ESP32=1

[env:firmware_esp32s3]
extends = common
board = esp32-s3-devkitc-1
build_flags = -D BOARD_ESP32S3=1
13 changes: 13 additions & 0 deletions firmware/src/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,16 @@ static SettingListItem LEGACY_OPTIONS[LEGACY_OPTIONS_COUNT] = {
};

static const size_t MAX_JSON_SIZE = 6000; // 6KB

// Визначення пінів для різних плат
#if defined(BOARD_ESP32S3)
#define SUPPORTED_LEDS_PINS {2, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}
#elif defined(BOARD_ESP32)
#define SUPPORTED_LEDS_PINS {2, 4, 12, 13, 14, 15, 16, 17, 18, 25, 26, 27, 32, 33}
#else
#error "Платформа не підтримується!"
#endif

// Макрос для генерації switch-case для кожного піна
#define GENERATE_PIN_CASE(pin) \
case pin: FastLED.addLeds<NEOPIXEL, pin>(const_cast<CRGB*>(leds), pixelcount); break;
Foroxon marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions firmware/src/Definitions.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#define LITE 0
#define TEST_MODE 0
#define TELNET_ENABLED 0
//#define BOARD_ESP32 1
//#define BOARD_ESP32S3 0
#if LITE
#define ARDUINO_OTA_ENABLED 0
#define FW_UPDATE_ENABLED 0
Expand Down
127 changes: 70 additions & 57 deletions firmware/src/JaamFirmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3426,15 +3426,13 @@ void initLegacy() {
#endif
switch (settings.getInt(LEGACY)) {
case 0:
LOG.println("Mode: jaam 1");
LOG.println("Mode: jaam 1");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишні пробіли в кінці рядка


pinMode(settings.getInt(POWER_PIN), OUTPUT);
pinMode(settings.getInt(WIFI_PIN), OUTPUT);
pinMode(settings.getInt(DATA_PIN), OUTPUT);
pinMode(settings.getInt(HA_PIN), OUTPUT);
//pinMode(settings.reservedpin, OUTPUT);

servicePin(POWER, HIGH, false);
settings.saveInt(POWER_PIN, 12, false);
settings.saveInt(WIFI_PIN, 14, false);
settings.saveInt(DATA_PIN, 25, false);
settings.saveInt(HA_PIN, 26, false);
settings.saveInt(RESERVED_PIN, 27, false);
Foroxon marked this conversation as resolved.
Show resolved Hide resolved

settings.saveInt(KYIV_DISTRICT_MODE, 3, false);
settings.saveInt(MAIN_LED_PIN, 13, false);
Expand All @@ -3446,6 +3444,14 @@ void initLegacy() {
settings.saveInt(DISPLAY_MODEL, 1, false);
settings.saveInt(DISPLAY_HEIGHT, 64, false);
settings.saveBool(USE_TOUCH_BUTTON_1, 0, false);

pinMode(settings.getInt(POWER_PIN), OUTPUT);
pinMode(settings.getInt(WIFI_PIN), OUTPUT);
pinMode(settings.getInt(DATA_PIN), OUTPUT);
pinMode(settings.getInt(HA_PIN), OUTPUT);

servicePin(POWER, HIGH, false);

break;
case 1:
LOG.println("Mode: transcarpathia");
Expand Down Expand Up @@ -3521,57 +3527,64 @@ void initClearPin() {
}

void initFastledStrip(uint8_t pin, const CRGB *leds, int pixelcount) {
switch (pin)
{
case 2:
FastLED.addLeds<NEOPIXEL, 2>(const_cast<CRGB*>(leds), pixelcount);
break;
case 4:
FastLED.addLeds<NEOPIXEL, 4>(const_cast<CRGB*>(leds), pixelcount);
break;
case 12:
FastLED.addLeds<NEOPIXEL, 12>(const_cast<CRGB*>(leds), pixelcount);
break;
case 13:
FastLED.addLeds<NEOPIXEL, 13>(const_cast<CRGB*>(leds), pixelcount);
break;
case 14:
FastLED.addLeds<NEOPIXEL, 14>(const_cast<CRGB*>(leds), pixelcount);
break;
case 15:
FastLED.addLeds<NEOPIXEL, 15>(const_cast<CRGB*>(leds), pixelcount);
break;
case 16:
FastLED.addLeds<NEOPIXEL, 16>(const_cast<CRGB*>(leds), pixelcount);
break;
case 17:
FastLED.addLeds<NEOPIXEL, 17>(const_cast<CRGB*>(leds), pixelcount);
break;
case 18:
FastLED.addLeds<NEOPIXEL, 18>(const_cast<CRGB*>(leds), pixelcount);
break;
case 25:
FastLED.addLeds<NEOPIXEL, 25>(const_cast<CRGB*>(leds), pixelcount);
break;
case 26:
FastLED.addLeds<NEOPIXEL, 26>(const_cast<CRGB*>(leds), pixelcount);
break;
case 27:
FastLED.addLeds<NEOPIXEL, 27>(const_cast<CRGB*>(leds), pixelcount);
break;
case 32:
FastLED.addLeds<NEOPIXEL, 32>(const_cast<CRGB*>(leds), pixelcount);
break;
case 33:
FastLED.addLeds<NEOPIXEL, 33>(const_cast<CRGB*>(leds), pixelcount);
break;
default:
LOG.print("This PIN is not supported for LEDs: ");
LOG.println(pin);
break;
}
bool isSupported = false;

// Перевірка, чи пін входить до підтримуваних
for (auto supportedPin : SUPPORTED_LEDS_PINS) {
if (pin == supportedPin) {
isSupported = true;
break;
}
}

if (!isSupported) {
LOG.print("This PIN is not supported for LEDs: ");
LOG.println(pin);
return;
}

switch (pin) {
#if defined(BOARD_ESP32S3)
GENERATE_PIN_CASE(2)
GENERATE_PIN_CASE(4)
GENERATE_PIN_CASE(8)
GENERATE_PIN_CASE(9)
GENERATE_PIN_CASE(10)
GENERATE_PIN_CASE(11)
GENERATE_PIN_CASE(12)
GENERATE_PIN_CASE(13)
GENERATE_PIN_CASE(14)
GENERATE_PIN_CASE(15)
GENERATE_PIN_CASE(16)
GENERATE_PIN_CASE(17)
GENERATE_PIN_CASE(18)
GENERATE_PIN_CASE(19)
GENERATE_PIN_CASE(20)
GENERATE_PIN_CASE(21)
#elif defined(BOARD_ESP32)
GENERATE_PIN_CASE(2)
GENERATE_PIN_CASE(4)
GENERATE_PIN_CASE(12)
GENERATE_PIN_CASE(13)
GENERATE_PIN_CASE(14)
GENERATE_PIN_CASE(15)
GENERATE_PIN_CASE(16)
GENERATE_PIN_CASE(17)
GENERATE_PIN_CASE(18)
GENERATE_PIN_CASE(25)
GENERATE_PIN_CASE(26)
GENERATE_PIN_CASE(27)
GENERATE_PIN_CASE(32)
GENERATE_PIN_CASE(33)
#endif
default:
LOG.print("Error: Unexpected pin configuration for this board: ");
LOG.println(pin);
break;
}
}


void initStrip() {
LOG.println("Init leds");
LOG.print("pixelpin: ");
Expand Down
10 changes: 5 additions & 5 deletions firmware/src/JaamSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ std::map<Type, SettingItemInt> intSettings = {
{CLEAR_PIN, {"cp", -1}},
{BUZZER_PIN, {"bzp", -1}},
{LIGHT_SENSOR_PIN, {"lp", -1}},
{POWER_PIN, {"powp", 12}},
{WIFI_PIN, {"wifip", 14}},
{DATA_PIN, {"datap", 25}},
{HA_PIN, {"hap", 26}},
{RESERVED_PIN, {"resp", 27}},
{POWER_PIN, {"powp", -1}},
{WIFI_PIN, {"wifip", -1}},
{DATA_PIN, {"datap", -1}},
{HA_PIN, {"hap", -1}},
{RESERVED_PIN, {"resp", -1}},
{ALERT_CLEAR_PIN_MODE, {"acpm", 0}},
{HA_MQTT_PORT, {"ha_mqttport", 1883}},
{CURRENT_BRIGHTNESS, {"cbr", 50}},
Expand Down
Loading