mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-24 14:26:11 +02:00
Merge branch 'main' of https://github.com/grindylow/ahoy
This commit is contained in:
commit
44b31f765c
11 changed files with 114 additions and 14 deletions
tools/esp8266
|
@ -7,6 +7,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
app::app() : Main() {
|
||||
DPRINTLN(F("app::app():Main"));
|
||||
mSendTicker = 0xffff;
|
||||
mSendInterval = 0;
|
||||
mMqttTicker = 0xffff;
|
||||
|
@ -40,6 +41,7 @@ app::~app(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::setup(uint32_t timeout) {
|
||||
DPRINTLN(F("app::setup"));
|
||||
Main::setup(timeout);
|
||||
|
||||
mWeb->on("/", std::bind(&app::showIndex, this));
|
||||
|
@ -150,6 +152,9 @@ void app::setup(uint32_t timeout) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::loop(void) {
|
||||
//DPRINT(F("a"));
|
||||
//DPRINTLN(F("a"));
|
||||
//app_loops++;
|
||||
Main::loop();
|
||||
|
||||
mSys->Radio.loop();
|
||||
|
@ -157,6 +162,9 @@ void app::loop(void) {
|
|||
yield();
|
||||
|
||||
if(checkTicker(&mRxTicker, 5)) {
|
||||
//DPRINTLN(F("app_loops =") + String(app_loops));
|
||||
//app_loops=0;
|
||||
//DPRINT(F("a"));
|
||||
bool rxRdy = mSys->Radio.switchRxCh();
|
||||
|
||||
if(!mSys->BufCtrl.empty()) {
|
||||
|
@ -293,6 +301,7 @@ void app::loop(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::handleIntr(void) {
|
||||
DPRINTLN(F("app::handleIntr"));
|
||||
mSys->Radio.handleIntr();
|
||||
}
|
||||
|
||||
|
@ -300,6 +309,7 @@ void app::handleIntr(void) {
|
|||
//-----------------------------------------------------------------------------
|
||||
bool app::buildPayload(uint8_t id) {
|
||||
//DPRINTLN("Payload");
|
||||
DPRINTLN(F("app::buildPayload"));
|
||||
uint16_t crc = 0xffff, crcRcv;
|
||||
if(mPayload[id].maxPackId > MAX_PAYLOAD_ENTRIES)
|
||||
mPayload[id].maxPackId = MAX_PAYLOAD_ENTRIES;
|
||||
|
@ -324,6 +334,8 @@ bool app::buildPayload(uint8_t id) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::processPayload(bool retransmit) {
|
||||
//DPRINTLN(F("app::processPayload"));
|
||||
//DPRINT(F("p"));
|
||||
for(uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
||||
Inverter<> *iv = mSys->getInverterByPos(id);
|
||||
if(NULL != iv) {
|
||||
|
@ -381,15 +393,19 @@ void app::processPayload(bool retransmit) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showIndex(void) {
|
||||
DPRINTLN(F("app::showIndex"));
|
||||
String html = FPSTR(index_html);
|
||||
html.replace(F("{DEVICE}"), mDeviceName);
|
||||
html.replace(F("{VERSION}"), mVersion);
|
||||
html.replace(F("{TS}"), String(mSendInterval) + " ");
|
||||
html.replace(F("{JS_TS}"), String(mSendInterval * 1000));
|
||||
mWeb->send(200, "text/html", html);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showSetup(void) {
|
||||
DPRINTLN(F("app::showSetup"));
|
||||
// overrides same method in main.cpp
|
||||
|
||||
uint16_t interval;
|
||||
|
@ -518,12 +534,14 @@ void app::showSetup(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showSave(void) {
|
||||
DPRINTLN(F("app::showSave"));
|
||||
saveValues(true);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showErase() {
|
||||
DPRINTLN(F("app::showErase"));
|
||||
eraseSettings();
|
||||
showReboot();
|
||||
}
|
||||
|
@ -531,6 +549,7 @@ void app::showErase() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showStatistics(void) {
|
||||
DPRINTLN(F("app::showStatistics"));
|
||||
String content = F("Receive success: ") + String(mRxSuccess) + "\n";
|
||||
content += F("Receive fail: ") + String(mRxFailed) + "\n";
|
||||
content += F("Send Cnt: ") + String(mSys->Radio.mSendCnt) + String("\n\n");
|
||||
|
@ -579,6 +598,7 @@ void app::showStatistics(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showHoymiles(void) {
|
||||
DPRINTLN(F("app::showHoymiles"));
|
||||
String html = FPSTR(hoymiles_html);
|
||||
html.replace(F("{DEVICE}"), mDeviceName);
|
||||
html.replace(F("{VERSION}"), mVersion);
|
||||
|
@ -590,6 +610,7 @@ void app::showHoymiles(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::showLiveData(void) {
|
||||
DPRINTLN(F("app::showLiveData"));
|
||||
String modHtml;
|
||||
for(uint8_t id = 0; id < mSys->getNumInverters(); id++) {
|
||||
Inverter<> *iv = mSys->getInverterByPos(id);
|
||||
|
@ -662,6 +683,7 @@ void app::showLiveData(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::saveValues(bool webSend = true) {
|
||||
DPRINTLN(F("app::saveValues"));
|
||||
Main::saveValues(false); // general configuration
|
||||
|
||||
if(mWeb->args() > 0) {
|
||||
|
@ -763,6 +785,7 @@ void app::saveValues(bool webSend = true) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::updateCrc(void) {
|
||||
DPRINTLN(F("app::updateCrc"));
|
||||
Main::updateCrc();
|
||||
|
||||
uint16_t crc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue