Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ jobs:
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
run: pio run -e esp32dev
- name: Upload artifacts
run: pio run
- name: Upload esp32dev
uses: actions/upload-artifact@v3
with:
name: image
path: .pio/build/esp32dev/firmware.bin
name: esp32dev
path: .pio/build/esp32dev/firmware.bin
- name: Upload m5stack
uses: actions/upload-artifact@v3
with:
name: m5stack
path: .pio/build/m5stack/firmware.bin
7 changes: 7 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
#include <Preferences.h>
#define debugSerial Serial
#define modbusSerial Serial2
#ifdef M5STACK
#define modbusRx GPIO_NUM_22
#define modbusTx GPIO_NUM_19
#else
#define modbusRx -1
#define modbusTx -1
#endif
#define DEBUG

class Config{
Expand Down
12 changes: 9 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
[env]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
https://github.com/tzapu/WiFiManager.git
https://github.com/me-no-dev/ESPAsyncWebServer.git
eModbus
build_flags = -DLOG_LEVEL=LOG_LEVEL_DEBUG
monitor_speed = 115200
monitor_speed = 115200

[env:esp32dev]
board = esp32dev

[env:m5stack]
board = m5stack-atom
build_flags = -DM5STACK
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void setup() {
wm.autoConnect();
dbgln("[wifi] finished");
dbgln("[modbus] start");
modbusSerial.begin(config.getModbusBaudRate(), config.getModbusConfig());
modbusSerial.begin(config.getModbusBaudRate(), config.getModbusConfig(), modbusRx, modbusTx);
MBclient = new ModbusClientRTU(modbusSerial, config.getModbusRtsPin());
MBclient->setTimeout(1000);
MBclient->begin();
Expand Down