mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-23 11:17:11 +02:00
combine CMD module status to antenna-symbol
... and for this harmonize hmRadio and hmsRadio is_Chip_Connected()
This commit is contained in:
parent
81a05b3752
commit
99add5c8b2
7 changed files with 30 additions and 10 deletions
|
@ -86,7 +86,11 @@ void app::setup() {
|
|||
// Plugins
|
||||
#if defined(PLUGIN_DISPLAY)
|
||||
if (mConfig->plugin.display.type != 0)
|
||||
mDisplay.setup(this, &mConfig->plugin.display, &mSys, &mNrfRadio, &mTimestamp);
|
||||
#if defined(ESP32)
|
||||
mDisplay.setup(this, &mConfig->plugin.display, &mSys, &mNrfRadio, &mCmtRadio, &mTimestamp);
|
||||
#else
|
||||
mDisplay.setup(this, &mConfig->plugin.display, &mSys, &mNrfRadio, NULL, &mTimestamp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mPubSerial.setup(mConfig, &mSys, &mTimestamp);
|
||||
|
|
|
@ -51,7 +51,7 @@ typedef PubSerial<HmSystemType> PubSerialType;
|
|||
#if defined(PLUGIN_DISPLAY)
|
||||
#include "plugins/Display/Display.h"
|
||||
#include "plugins/Display/Display_data.h"
|
||||
typedef Display<HmSystemType, HmRadio<>> DisplayType;
|
||||
typedef Display<HmSystemType, Radio> DisplayType;
|
||||
#endif
|
||||
|
||||
class app : public IApp, public ah::Scheduler {
|
||||
|
|
|
@ -53,8 +53,11 @@ class IApp {
|
|||
virtual bool getSettingsValid() = 0;
|
||||
virtual void setMqttDiscoveryFlag() = 0;
|
||||
virtual void setMqttPowerLimitAck(Inverter<> *iv) = 0;
|
||||
|
||||
virtual bool getMqttIsConnected() = 0;
|
||||
|
||||
virtual bool getNrfEnabled() = 0;
|
||||
virtual bool getCmtEnabled() = 0;
|
||||
|
||||
virtual uint32_t getMqttRxCnt() = 0;
|
||||
virtual uint32_t getMqttTxCnt() = 0;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ class Radio {
|
|||
virtual void sendControlPacket(Inverter<> *iv, uint8_t cmd, uint16_t *data, bool isRetransmit) = 0;
|
||||
virtual bool switchFrequency(Inverter<> *iv, uint32_t fromkHz, uint32_t tokHz) { return true; }
|
||||
virtual bool switchFrequencyCh(Inverter<> *iv, uint8_t fromCh, uint8_t toCh) { return true; }
|
||||
virtual bool isChipConnected(void) { return false; }
|
||||
|
||||
virtual void loop(void) {};
|
||||
|
||||
bool get() {
|
||||
|
|
|
@ -45,7 +45,7 @@ class CmtRadio : public Radio {
|
|||
}
|
||||
}
|
||||
|
||||
bool isConnected() {
|
||||
bool isChipConnected(void) {
|
||||
return mCmtAvail;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,16 +15,17 @@
|
|||
#include "Display_ePaper.h"
|
||||
#include "Display_data.h"
|
||||
|
||||
template <class HMSYSTEM, class HMRADIO>
|
||||
template <class HMSYSTEM, class RADIO>
|
||||
class Display {
|
||||
public:
|
||||
Display() {
|
||||
mMono = NULL;
|
||||
}
|
||||
|
||||
void setup(IApp *app, display_t *cfg, HMSYSTEM *sys, HMRADIO *radio, uint32_t *utcTs) {
|
||||
void setup(IApp *app, display_t *cfg, HMSYSTEM *sys, RADIO *hmradio, RADIO *hmsradio, uint32_t *utcTs) {
|
||||
mApp = app;
|
||||
mHmRadio = radio;
|
||||
mHmRadio = hmradio;
|
||||
mHmsRadio = hmsradio;
|
||||
mCfg = cfg;
|
||||
mSys = sys;
|
||||
mUtcTs = utcTs;
|
||||
|
@ -141,7 +142,16 @@ class Display {
|
|||
mDisplayData.totalPower = (allOff) ? 0.0 : totalPower; // if all inverters are off, total power can't be greater than 0
|
||||
mDisplayData.totalYieldDay = totalYieldDay;
|
||||
mDisplayData.totalYieldTotal = totalYieldTotal;
|
||||
mDisplayData.RadioSymbol = mHmRadio->isChipConnected();
|
||||
bool nrf_en = mApp->getNrfEnabled();
|
||||
bool nrf_ok = nrf_en && mHmRadio->isChipConnected();
|
||||
#if defined(ESP32)
|
||||
bool cmt_en = mApp->getCmtEnabled();
|
||||
bool cmt_ok = cmt_en && mHmsRadio->isChipConnected();
|
||||
#else
|
||||
bool cmt_en = false;
|
||||
bool cmt_ok = false;
|
||||
#endif
|
||||
mDisplayData.RadioSymbol = (nrf_ok && !cmt_en) || (cmt_ok && !nrf_en) || (nrf_ok && cmt_ok);
|
||||
mDisplayData.WifiSymbol = (WiFi.status() == WL_CONNECTED);
|
||||
mDisplayData.MQTTSymbol = mApp->getMqttIsConnected();
|
||||
mDisplayData.RadioRSSI = (0 < mDisplayData.nrProducing) ? ivQuality2RadioRSSI(minQAllInv) : SCHAR_MIN; // Workaround as NRF24 has no RSSI. Approximation by quality levels from heuristic function
|
||||
|
@ -212,7 +222,8 @@ class Display {
|
|||
uint32_t *mUtcTs;
|
||||
display_t *mCfg;
|
||||
HMSYSTEM *mSys;
|
||||
HMRADIO *mHmRadio;
|
||||
RADIO *mHmRadio;
|
||||
RADIO *mHmsRadio;
|
||||
uint16_t mRefreshCycle;
|
||||
|
||||
#if defined(ESP32)
|
||||
|
|
|
@ -547,7 +547,7 @@ class RestApi {
|
|||
|
||||
void getRadioCmtInfo(JsonObject obj) {
|
||||
obj[F("en")] = (bool) mConfig->cmt.enabled;
|
||||
obj[F("isconnected")] = mRadioCmt->isConnected();
|
||||
obj[F("isconnected")] = mRadioCmt->isChipConnected();
|
||||
obj[F("sn")] = String(mRadioCmt->getDTUSn(), HEX);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue