mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-04 12:45:54 +02:00
Merge branch 'development03' of https://github.com/markusdd/ahoy into markusdd-development03
This commit is contained in:
commit
eb65024fc2
11 changed files with 105 additions and 13 deletions
3
.github/workflows/compile_development.yml
vendored
3
.github/workflows/compile_development.yml
vendored
|
@ -49,6 +49,9 @@ jobs:
|
||||||
- name: Run PlatformIO
|
- name: Run PlatformIO
|
||||||
run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment opendtufusionv1-release
|
run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment opendtufusionv1-release
|
||||||
|
|
||||||
|
- name: Copy boot_app0.bin
|
||||||
|
run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusionv1-release/ota.bin
|
||||||
|
|
||||||
- name: Rename Binary files
|
- name: Rename Binary files
|
||||||
id: rename-binary-files
|
id: rename-binary-files
|
||||||
working-directory: src
|
working-directory: src
|
||||||
|
|
3
.github/workflows/compile_release.yml
vendored
3
.github/workflows/compile_release.yml
vendored
|
@ -53,6 +53,9 @@ jobs:
|
||||||
- name: Run PlatformIO
|
- name: Run PlatformIO
|
||||||
run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment opendtufusionv1-release
|
run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment opendtufusionv1-release
|
||||||
|
|
||||||
|
- name: Copy boot_app0.bin
|
||||||
|
run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusionv1-release/ota.bin
|
||||||
|
|
||||||
- name: Rename Binary files
|
- name: Rename Binary files
|
||||||
id: rename-binary-files
|
id: rename-binary-files
|
||||||
working-directory: src
|
working-directory: src
|
||||||
|
|
45
ahoy.code-workspace
Normal file
45
ahoy.code-workspace
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "src"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"files.associations": {
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"format": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"queue": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"xhash": "cpp",
|
||||||
|
"xlocmon": "cpp",
|
||||||
|
"xlocnum": "cpp",
|
||||||
|
"xmemory": "cpp",
|
||||||
|
"xstring": "cpp",
|
||||||
|
"xtree": "cpp",
|
||||||
|
"xutility": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"unordered_set": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"ostream": "cpp"
|
||||||
|
},
|
||||||
|
"editor.formatOnSave": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,6 +50,7 @@ def readVersion(path, infile):
|
||||||
versionnumber += line[p+13:].rstrip() + "."
|
versionnumber += line[p+13:].rstrip() + "."
|
||||||
|
|
||||||
os.mkdir(path + "firmware/")
|
os.mkdir(path + "firmware/")
|
||||||
|
os.mkdir(path + "firmware/s3/")
|
||||||
sha = os.getenv("SHA",default="sha")
|
sha = os.getenv("SHA",default="sha")
|
||||||
|
|
||||||
versionout = version[:-1] + "_" + sha + "_esp8266.bin"
|
versionout = version[:-1] + "_" + sha + "_esp8266.bin"
|
||||||
|
@ -80,7 +81,7 @@ def readVersion(path, infile):
|
||||||
|
|
||||||
versionout = version[:-1] + "_" + sha + "_esp32s3.bin"
|
versionout = version[:-1] + "_" + sha + "_esp32s3.bin"
|
||||||
src = path + ".pio/build/opendtufusionv1-release/firmware.bin"
|
src = path + ".pio/build/opendtufusionv1-release/firmware.bin"
|
||||||
dst = path + "firmware/" + versionout
|
dst = path + "firmware/s3/" + versionout
|
||||||
os.rename(src, dst)
|
os.rename(src, dst)
|
||||||
|
|
||||||
# other ESP32 bin files
|
# other ESP32 bin files
|
||||||
|
@ -89,6 +90,14 @@ def readVersion(path, infile):
|
||||||
os.rename(src + "bootloader.bin", dst + "bootloader.bin")
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin")
|
||||||
os.rename(src + "partitions.bin", dst + "partitions.bin")
|
os.rename(src + "partitions.bin", dst + "partitions.bin")
|
||||||
genOtaBin(path + "firmware/")
|
genOtaBin(path + "firmware/")
|
||||||
|
|
||||||
|
# other ESP32S3 bin files
|
||||||
|
src = path + ".pio/build/opendtufusionv1-release/"
|
||||||
|
dst = path + "firmware/s3/"
|
||||||
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin")
|
||||||
|
os.rename(src + "partitions.bin", dst + "partitions.bin")
|
||||||
|
os.rename(src + "ota.bin", dst + "ota.bin")
|
||||||
|
|
||||||
os.rename("../scripts/gh-action-dev-build-flash.html", path + "install.html")
|
os.rename("../scripts/gh-action-dev-build-flash.html", path + "install.html")
|
||||||
|
|
||||||
print("name=" + versionnumber[:-1] )
|
print("name=" + versionnumber[:-1] )
|
||||||
|
|
28
src/app.cpp
28
src/app.cpp
|
@ -387,30 +387,40 @@ void app::mqttSubRxCb(JsonObject obj) {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void app::setupLed(void) {
|
void app::setupLed(void) {
|
||||||
/** LED connection diagram
|
|
||||||
* \\
|
uint8_t led_off = (mConfig->led.led_high_active != 0) ? LOW : HIGH;
|
||||||
* PIN ---- |<----- 3.3V
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
if (mConfig->led.led0 != 0xff) {
|
if (mConfig->led.led0 != 0xff) {
|
||||||
pinMode(mConfig->led.led0, OUTPUT);
|
pinMode(mConfig->led.led0, OUTPUT);
|
||||||
digitalWrite(mConfig->led.led0, HIGH); // LED off
|
digitalWrite(mConfig->led.led0, led_off);
|
||||||
}
|
}
|
||||||
if (mConfig->led.led1 != 0xff) {
|
if (mConfig->led.led1 != 0xff) {
|
||||||
pinMode(mConfig->led.led1, OUTPUT);
|
pinMode(mConfig->led.led1, OUTPUT);
|
||||||
digitalWrite(mConfig->led.led1, HIGH); // LED off
|
digitalWrite(mConfig->led.led1, led_off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void app::updateLed(void) {
|
void app::updateLed(void) {
|
||||||
|
|
||||||
|
uint8_t led_off = (mConfig->led.led_high_active != 0) ? LOW : HIGH;
|
||||||
|
uint8_t led_on = (mConfig->led.led_high_active != 0) ? HIGH : LOW;
|
||||||
|
|
||||||
if (mConfig->led.led0 != 0xff) {
|
if (mConfig->led.led0 != 0xff) {
|
||||||
Inverter<> *iv = mSys.getInverterByPos(0);
|
Inverter<> *iv = mSys.getInverterByPos(0);
|
||||||
if (NULL != iv) {
|
if (NULL != iv) {
|
||||||
if (iv->isProducing(mTimestamp))
|
if (iv->isProducing(mTimestamp))
|
||||||
digitalWrite(mConfig->led.led0, LOW); // LED on
|
digitalWrite(mConfig->led.led0, led_on);
|
||||||
else
|
else
|
||||||
digitalWrite(mConfig->led.led0, HIGH); // LED off
|
digitalWrite(mConfig->led.led0, led_off);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mConfig->led.led1 != 0xff) {
|
||||||
|
if (getMqttIsConnected()) {
|
||||||
|
digitalWrite(mConfig->led.led1, led_on);
|
||||||
|
} else {
|
||||||
|
digitalWrite(mConfig->led.led1, led_off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,8 +213,8 @@ class app : public IApp, public ah::Scheduler {
|
||||||
|
|
||||||
void mqttSubRxCb(JsonObject obj);
|
void mqttSubRxCb(JsonObject obj);
|
||||||
|
|
||||||
void setupLed(void);
|
void setupLed();
|
||||||
void updateLed(void);
|
void updateLed();
|
||||||
|
|
||||||
void tickReboot(void) {
|
void tickReboot(void) {
|
||||||
DPRINTLN(DBG_INFO, F("Rebooting..."));
|
DPRINTLN(DBG_INFO, F("Rebooting..."));
|
||||||
|
|
|
@ -100,6 +100,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t led0; // first LED pin
|
uint8_t led0; // first LED pin
|
||||||
uint8_t led1; // second LED pin
|
uint8_t led1; // second LED pin
|
||||||
|
uint8_t led_high_active; // determines if LEDs are high or low active
|
||||||
} cfgLed_t;
|
} cfgLed_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -378,6 +379,7 @@ class settings {
|
||||||
|
|
||||||
mCfg.led.led0 = DEF_PIN_OFF;
|
mCfg.led.led0 = DEF_PIN_OFF;
|
||||||
mCfg.led.led1 = DEF_PIN_OFF;
|
mCfg.led.led1 = DEF_PIN_OFF;
|
||||||
|
mCfg.led.led_high_active = LOW;
|
||||||
|
|
||||||
memset(&mCfg.inst, 0, sizeof(cfgInst_t));
|
memset(&mCfg.inst, 0, sizeof(cfgInst_t));
|
||||||
|
|
||||||
|
@ -517,9 +519,11 @@ class settings {
|
||||||
if(set) {
|
if(set) {
|
||||||
obj[F("0")] = mCfg.led.led0;
|
obj[F("0")] = mCfg.led.led0;
|
||||||
obj[F("1")] = mCfg.led.led1;
|
obj[F("1")] = mCfg.led.led1;
|
||||||
|
obj[F("led_high_active")] = mCfg.led.led_high_active;
|
||||||
} else {
|
} else {
|
||||||
mCfg.led.led0 = obj[F("0")];
|
mCfg.led.led0 = obj[F("0")];
|
||||||
mCfg.led.led1 = obj[F("1")];
|
mCfg.led.led1 = obj[F("1")];
|
||||||
|
mCfg.led.led_high_active = obj[F("led_high_active")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,10 @@ monitor_filters =
|
||||||
[env:opendtufusionv1-release]
|
[env:opendtufusionv1-release]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
|
upload_protocol = esp-builtin
|
||||||
|
upload_speed = 115200
|
||||||
|
debug_tool = esp-builtin
|
||||||
|
debug_speed = 12000
|
||||||
build_flags = -D RELEASE -std=gnu++14
|
build_flags = -D RELEASE -std=gnu++14
|
||||||
build_unflags = -std=gnu++11
|
build_unflags = -std=gnu++11
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
|
|
|
@ -391,6 +391,7 @@ class RestApi {
|
||||||
obj[F("miso")] = mConfig->nrf.pinMiso;
|
obj[F("miso")] = mConfig->nrf.pinMiso;
|
||||||
obj[F("led0")] = mConfig->led.led0;
|
obj[F("led0")] = mConfig->led.led0;
|
||||||
obj[F("led1")] = mConfig->led.led1;
|
obj[F("led1")] = mConfig->led.led1;
|
||||||
|
obj[F("led_high_active")] = mConfig->led.led_high_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getRadio(JsonObject obj) {
|
void getRadio(JsonObject obj) {
|
||||||
|
|
|
@ -411,6 +411,10 @@
|
||||||
[47, "GPIO47"],
|
[47, "GPIO47"],
|
||||||
[48, "GPIO48"],
|
[48, "GPIO48"],
|
||||||
];
|
];
|
||||||
|
var led_high_active = [
|
||||||
|
[0, "low active"],
|
||||||
|
[1, "high active"],
|
||||||
|
];
|
||||||
|
|
||||||
const re = /11[2,4,6]1.*/;
|
const re = /11[2,4,6]1.*/;
|
||||||
|
|
||||||
|
@ -670,6 +674,14 @@
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
e.append(
|
||||||
|
ml("div", { class: "row mb-3" }, [
|
||||||
|
ml("div", { class: "col-12 col-sm-3 my-2" }, "LED polarity"),
|
||||||
|
ml("div", { class: "col-12 col-sm-9" },
|
||||||
|
sel('pinLedHighActive', led_high_active, obj['led_high_active'])
|
||||||
|
)
|
||||||
|
])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseRadio(obj) {
|
function parseRadio(obj) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#define WEB_SERIAL_BUF_SIZE 2048
|
#define WEB_SERIAL_BUF_SIZE 2048
|
||||||
|
|
||||||
const char *const pinArgNames[] = {"pinCs", "pinCe", "pinIrq", "pinSclk", "pinMosi", "pinMiso", "pinLed0", "pinLed1"};
|
const char *const pinArgNames[] = {"pinCs", "pinCe", "pinIrq", "pinSclk", "pinMosi", "pinMiso", "pinLed0", "pinLed1", "pinLedHighActive"};
|
||||||
|
|
||||||
template <class HMSYSTEM>
|
template <class HMSYSTEM>
|
||||||
class Web {
|
class Web {
|
||||||
|
@ -532,6 +532,7 @@ class Web {
|
||||||
case 5: mConfig->nrf.pinMiso = ((pin != 0xff) ? pin : DEF_MISO_PIN); break;
|
case 5: mConfig->nrf.pinMiso = ((pin != 0xff) ? pin : DEF_MISO_PIN); break;
|
||||||
case 6: mConfig->led.led0 = pin; break;
|
case 6: mConfig->led.led0 = pin; break;
|
||||||
case 7: mConfig->led.led1 = pin; break;
|
case 7: mConfig->led.led1 = pin; break;
|
||||||
|
case 8: mConfig->led.led_high_active = pin; break; // this is not really a pin but a polarity, but handling it close to here makes sense
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue