From 30fae779d9892828471ade274186fe22e31d0de5 Mon Sep 17 00:00:00 2001 From: Ray Jones Date: Mon, 22 Jun 2020 06:18:06 +1000 Subject: [PATCH] Added altitude test manipulation --- src/Afterburner.cpp | 15 +++++++++++++++ src/Protocol/TxManage.cpp | 26 ++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/Afterburner.cpp b/src/Afterburner.cpp index cfbb68d..c302054 100644 --- a/src/Afterburner.cpp +++ b/src/Afterburner.cpp @@ -227,6 +227,8 @@ bool bHaveWebClient = false; bool bBTconnected = false; long BootTime; +extern int altitudeTest; + //////////////////////////////////////////////////////////////////////////////////////////////////////// // Bluetooth instantiation // @@ -994,6 +996,19 @@ void checkDebugCommands() bSendVal = true; } #endif + else if(rxVal == 'a') { + switch(altitudeTest) { + case 0: altitudeTest = 100; break; + case 100: altitudeTest = 4000; break; + case 4000: altitudeTest = 10000; break; + case 10000: altitudeTest = 20000; break; + case 20000: altitudeTest = 0; break; + } + if(altitudeTest) + DebugPort.printf("Forcing altitude to %d\r\n", altitudeTest); + else + DebugPort.println("Normal altitude control"); + } else if(rxVal == 'b') { bReportBlueWireData = !bReportBlueWireData; DebugPort.printf("Toggled raw blue wire data reporting %s\r\n", bReportBlueWireData ? "ON" : "OFF"); diff --git a/src/Protocol/TxManage.cpp b/src/Protocol/TxManage.cpp index 158b8b1..e4bcb11 100644 --- a/src/Protocol/TxManage.cpp +++ b/src/Protocol/TxManage.cpp @@ -50,6 +50,7 @@ unsigned long CTxManage::m_nStartTime = 0; int CTxManage::m_nTxGatePin = 0; +int altitudeTest = 0; // Timer callback operates at ISRL // this means we should avoid any function NOT in IRAM. @@ -171,18 +172,23 @@ CTxManage::PrepareFrame(const CProtocol& basisFrame, bool isBTCmaster) m_TxFrame.setTemperature_Min(NVstore.getHeaterTuning().Tmin); // Minimum settable temperature m_TxFrame.setTemperature_Max(NVstore.getHeaterTuning().Tmax); // Maximum settable temperature - float altitude; - if(getTempSensor().getAltitude(altitude)) { // if a BME280 is fitted - // use calculated height - // set 0xeb 0x47 in "unknown bytes" - // - 0xeb happens with all pressure quipped units - // - 0x47 with all other than coffee pod which sends 0x00? - m_TxFrame.setAltitude(altitude, true); + if(altitudeTest) { + m_TxFrame.setAltitude(altitudeTest, true); } else { - // default height - yes it is weird, but that's what the simple controllers send! - // set 0x01 0x2c in "unknown bytes" - all no pressure equipped OEM controlelrs do that - m_TxFrame.setAltitude(3500, false); + float altitude; + if(getTempSensor().getAltitude(altitude)) { // if a BME280 is fitted + // use calculated height + // set 0xeb 0x47 in "unknown bytes" + // - 0xeb happens with all pressure quipped units + // - 0x47 with all other than coffee pod which sends 0x00? + m_TxFrame.setAltitude(altitude, true); + } + else { + // default height - yes it is weird, but that's what the simple controllers send! + // set 0x01 0x2c in "unknown bytes" - all no pressure equipped OEM controlelrs do that + m_TxFrame.setAltitude(3500, false); + } } m_TxFrame.setPump_Prime(_prime);