@ -87,6 +87,7 @@ class Display {
uint8_t nrprod = 0 ;
uint8_t nrsleep = 0 ;
int8_t minQAllInv = 4 ;
Inverter < > * iv ;
record_t < > * rec ;
@ -97,6 +98,15 @@ class Display {
if ( iv = = NULL )
continue ;
int8_t maxQInv = - 6 ;
for ( uint8_t ch = 0 ; ch < RF_MAX_CHANNEL_ID ; ch + + ) {
int8_t q = iv - > txRfQuality [ ch ] ;
if ( q > maxQInv )
maxQInv = q ;
}
if ( maxQInv < minQAllInv )
minQAllInv = maxQInv ;
rec = iv - > getRecordStruct ( RealTimeRunData_Debug ) ;
if ( iv - > isProducing ( ) )
@ -123,7 +133,7 @@ class Display {
mDisplayData . RadioSymbol = mHmRadio - > isChipConnected ( ) ;
mDisplayData . WifiSymbol = ( WiFi . status ( ) = = WL_CONNECTED ) ;
mDisplayData . MQTTSymbol = mApp - > getMqttIsConnected ( ) ;
mDisplayData . RadioRSSI = ( 0 < mDisplayData . nrProducing ) ? 0 : SCHAR_MIN ; // Workaround as NRF24 has no RSSI. Could be approximated by transmisson error heuristic in the future
mDisplayData . RadioRSSI = ( 0 < mDisplayData . nrProducing ) ? ivQuality2RadioRSSI ( minQAllInv ) : SCHAR_MIN ; // Workaround as NRF24 has no RSSI. Approximation by quality levels from heuristic function
mDisplayData . WifiRSSI = ( WiFi . status ( ) = = WL_CONNECTED ) ? WiFi . RSSI ( ) : SCHAR_MIN ;
mDisplayData . ipAddress = WiFi . localIP ( ) ;
time_t utc = mApp - > getTimestamp ( ) ;
@ -148,6 +158,26 @@ class Display {
# endif
}
// approximate RSSI in dB by invQuality levels from heuristic function (very unscientific but better than nothing :-) )
int8_t ivQuality2RadioRSSI ( int8_t invQuality ) {
int8_t pseudoRSSIdB ;
switch ( invQuality ) {
case 4 : pseudoRSSIdB = - 55 ; break ;
case 3 :
case 2 :
case 1 : pseudoRSSIdB = - 65 ; break ;
case 0 :
case - 1 :
case - 2 : pseudoRSSIdB = - 75 ; break ;
case - 3 :
case - 4 :
case - 5 : pseudoRSSIdB = - 85 ; break ;
case - 6 :
default : pseudoRSSIdB = - 95 ; break ;
}
return ( pseudoRSSIdB ) ;
}
// private member variables
IApp * mApp ;
DisplayData mDisplayData ;