mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-06 04:31:37 +02:00
0.8.35
* added dim option for LEDS * changed reload time for opendtufusion after update to 5s
This commit is contained in:
parent
3178325b42
commit
b5cdd775a7
8 changed files with 1052 additions and 70 deletions
2
.github/workflows/compile_release.yml
vendored
2
.github/workflows/compile_release.yml
vendored
|
@ -77,7 +77,7 @@ jobs:
|
|||
VERSION: ${{ steps.rename-binary-files.outputs.name }}
|
||||
|
||||
- name: Create Artifact
|
||||
run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip src/firmware/* rc/firmware/s3/* User_Manual.md
|
||||
run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip src/firmware/* User_Manual.md
|
||||
|
||||
- name: Upload Release
|
||||
id: upload-release
|
||||
|
|
1027
src/CHANGES.md
1027
src/CHANGES.md
File diff suppressed because it is too large
Load diff
22
src/app.cpp
22
src/app.cpp
|
@ -102,14 +102,14 @@ void app::setup() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::loop(void) {
|
||||
ah::Scheduler::loop();
|
||||
|
||||
if(mConfig->nrf.enabled)
|
||||
mNrfRadio.loop();
|
||||
#if defined(ESP32)
|
||||
if(mConfig->cmt.enabled)
|
||||
mCmtRadio.loop();
|
||||
#endif
|
||||
|
||||
ah::Scheduler::loop();
|
||||
mCommunication.loop();
|
||||
|
||||
if (mMqttEnabled && mNetworkConnected)
|
||||
|
@ -449,22 +449,22 @@ void app::mqttSubRxCb(JsonObject obj) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::setupLed(void) {
|
||||
uint8_t led_off = (mConfig->led.led_high_active) ? LOW : HIGH;
|
||||
uint8_t led_off = (mConfig->led.high_active) ? 0 : 255;
|
||||
|
||||
if (mConfig->led.led0 != DEF_PIN_OFF) {
|
||||
pinMode(mConfig->led.led0, OUTPUT);
|
||||
digitalWrite(mConfig->led.led0, led_off);
|
||||
analogWrite(mConfig->led.led0, led_off);
|
||||
}
|
||||
if (mConfig->led.led1 != DEF_PIN_OFF) {
|
||||
pinMode(mConfig->led.led1, OUTPUT);
|
||||
digitalWrite(mConfig->led.led1, led_off);
|
||||
analogWrite(mConfig->led.led1, led_off);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::updateLed(void) {
|
||||
uint8_t led_off = (mConfig->led.led_high_active) ? LOW : HIGH;
|
||||
uint8_t led_on = (mConfig->led.led_high_active) ? HIGH : LOW;
|
||||
uint8_t led_off = (mConfig->led.high_active) ? 0 : 255;
|
||||
uint8_t led_on = (mConfig->led.high_active) ? (mConfig->led.luminance) : (255-mConfig->led.luminance);
|
||||
|
||||
if (mConfig->led.led0 != DEF_PIN_OFF) {
|
||||
Inverter<> *iv;
|
||||
|
@ -473,20 +473,20 @@ void app::updateLed(void) {
|
|||
if (NULL != iv) {
|
||||
if (iv->isProducing()) {
|
||||
// turn on when at least one inverter is producing
|
||||
digitalWrite(mConfig->led.led0, led_on);
|
||||
analogWrite(mConfig->led.led0, led_on);
|
||||
break;
|
||||
}
|
||||
else if(iv->config->enabled)
|
||||
digitalWrite(mConfig->led.led0, led_off);
|
||||
analogWrite(mConfig->led.led0, led_off);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mConfig->led.led1 != DEF_PIN_OFF) {
|
||||
if (getMqttIsConnected()) {
|
||||
digitalWrite(mConfig->led.led1, led_on);
|
||||
analogWrite(mConfig->led.led1, led_on);
|
||||
} else {
|
||||
digitalWrite(mConfig->led.led1, led_off);
|
||||
analogWrite(mConfig->led.led1, led_off);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html#flash-layout
|
||||
* */
|
||||
|
||||
#define CONFIG_VERSION 6
|
||||
#define CONFIG_VERSION 7
|
||||
|
||||
|
||||
#define PROT_MASK_INDEX 0x0001
|
||||
|
@ -119,7 +119,8 @@ typedef struct {
|
|||
typedef struct {
|
||||
uint8_t led0; // first LED pin
|
||||
uint8_t led1; // second LED pin
|
||||
bool led_high_active; // determines if LEDs are high or low active
|
||||
bool high_active; // determines if LEDs are high or low active
|
||||
uint8_t luminance; // luminance of LED
|
||||
} cfgLed_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -452,7 +453,8 @@ class settings {
|
|||
|
||||
mCfg.led.led0 = DEF_LED0;
|
||||
mCfg.led.led1 = DEF_LED1;
|
||||
mCfg.led.led_high_active = LED_HIGH_ACTIVE;
|
||||
mCfg.led.high_active = LED_HIGH_ACTIVE;
|
||||
mCfg.led.luminance = 255;
|
||||
|
||||
memset(&mCfg.inst, 0, sizeof(cfgInst_t));
|
||||
|
||||
|
@ -493,6 +495,9 @@ class settings {
|
|||
mCfg.inst.gapMs = 500;
|
||||
mCfg.inst.readGrid = true;
|
||||
}
|
||||
if(mCfg.configVersion < 7) {
|
||||
mCfg.led.luminance = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,11 +674,13 @@ class settings {
|
|||
if(set) {
|
||||
obj[F("0")] = mCfg.led.led0;
|
||||
obj[F("1")] = mCfg.led.led1;
|
||||
obj[F("act_high")] = mCfg.led.led_high_active;
|
||||
obj[F("act_high")] = mCfg.led.high_active;
|
||||
obj[F("lum")] = mCfg.led.luminance;
|
||||
} else {
|
||||
getVal<uint8_t>(obj, F("0"), &mCfg.led.led0);
|
||||
getVal<uint8_t>(obj, F("1"), &mCfg.led.led1);
|
||||
getVal<bool>(obj, F("act_high"), &mCfg.led.led_high_active);
|
||||
getVal<bool>(obj, F("act_high"), &mCfg.led.high_active);
|
||||
getVal<uint8_t>(obj, F("lum"), &mCfg.led.luminance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 34
|
||||
#define VERSION_PATCH 35
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -564,7 +564,8 @@ class RestApi {
|
|||
obj[F("miso")] = mConfig->nrf.pinMiso;
|
||||
obj[F("led0")] = mConfig->led.led0;
|
||||
obj[F("led1")] = mConfig->led.led1;
|
||||
obj[F("led_high_active")] = mConfig->led.led_high_active;
|
||||
obj[F("led_high_active")] = mConfig->led.high_active;
|
||||
obj[F("led_lum")] = mConfig->led.luminance;
|
||||
}
|
||||
|
||||
#if defined(ESP32)
|
||||
|
|
|
@ -918,8 +918,12 @@
|
|||
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'])
|
||||
sel('pinLedHighActive', led_high_active, obj.led_high_active)
|
||||
)
|
||||
]),
|
||||
ml("div", { class: "row mb-3" }, [
|
||||
ml("div", { class: "col-12 col-sm-3 my-2" }, "LED luminance (0-255)"),
|
||||
ml("div", { class: "col-12 col-sm-9" }, ml("input", {class: "text", type: "number", name: "pinLedLum", value: obj.led_lum, min: 0, max: 255}, null))
|
||||
])
|
||||
)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#define WEB_SERIAL_BUF_SIZE 2048
|
||||
|
||||
const char* const pinArgNames[] = {"pinCs", "pinCe", "pinIrq", "pinSclk", "pinMosi", "pinMiso", "pinLed0", "pinLed1", "pinLedHighActive", "pinCmtSclk", "pinSdio", "pinCsb", "pinFcsb", "pinGpio3"};
|
||||
const char* const pinArgNames[] = {"pinCs", "pinCe", "pinIrq", "pinSclk", "pinMosi", "pinMiso", "pinLed0", "pinLed1", "pinLedHighActive", "pinLedLum", "pinCmtSclk", "pinSdio", "pinCsb", "pinFcsb", "pinGpio3"};
|
||||
|
||||
template <class HMSYSTEM>
|
||||
class Web {
|
||||
|
@ -284,12 +284,18 @@ class Web {
|
|||
|
||||
bool reboot = (!Update.hasError());
|
||||
|
||||
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: ");
|
||||
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"");
|
||||
#if defined(ETHERNET) && defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
html += F("5");
|
||||
#else
|
||||
html += F("20");
|
||||
#endif
|
||||
html += F("; URL=/\"></head><body>Update: ");
|
||||
if (reboot)
|
||||
html += "success";
|
||||
else
|
||||
html += "failed";
|
||||
html += F("<br/><br/>rebooting ... auto reload after 20s</body></html>");
|
||||
html += F("<br/><br/>rebooting ...</body></html>");
|
||||
|
||||
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), html);
|
||||
response->addHeader("Connection", "close");
|
||||
|
@ -521,7 +527,7 @@ class Web {
|
|||
|
||||
// pinout
|
||||
uint8_t pin;
|
||||
for (uint8_t i = 0; i < 14; i++) {
|
||||
for (uint8_t i = 0; i < 15; i++) {
|
||||
pin = request->arg(String(pinArgNames[i])).toInt();
|
||||
switch(i) {
|
||||
case 0: mConfig->nrf.pinCs = ((pin != 0xff) ? pin : DEF_NRF_CS_PIN); break;
|
||||
|
@ -532,12 +538,13 @@ class Web {
|
|||
case 5: mConfig->nrf.pinMiso = ((pin != 0xff) ? pin : DEF_NRF_MISO_PIN); break;
|
||||
case 6: mConfig->led.led0 = 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
|
||||
case 9: mConfig->cmt.pinSclk = pin; break;
|
||||
case 10: mConfig->cmt.pinSdio = pin; break;
|
||||
case 11: mConfig->cmt.pinCsb = pin; break;
|
||||
case 12: mConfig->cmt.pinFcsb = pin; break;
|
||||
case 13: mConfig->cmt.pinIrq = pin; break;
|
||||
case 8: mConfig->led.high_active = pin; break; // this is not really a pin but a polarity, but handling it close to here makes sense
|
||||
case 9: mConfig->led.luminance = pin; break; // this is not really a pin but a polarity, but handling it close to here makes sense
|
||||
case 10: mConfig->cmt.pinSclk = pin; break;
|
||||
case 11: mConfig->cmt.pinSdio = pin; break;
|
||||
case 12: mConfig->cmt.pinCsb = pin; break;
|
||||
case 13: mConfig->cmt.pinFcsb = pin; break;
|
||||
case 14: mConfig->cmt.pinIrq = pin; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue