Browse Source
companion: Suspend radio when hibernating
This should significantly reduce power consumption in hibernation.
Fixes : #1014
Signed-off-by: Jaroslav Škarvada <[email protected] >
Signed-off-by: Frieder Schrempf <[email protected] > # generalize for all radios and UIs
pull/1122/head
Jaroslav Škarvada
6 months ago
committed by
Frieder Schrempf
No known key found for this signature in database
GPG Key ID: E7DD51F45F833802
4 changed files with
9 additions and
2 deletions
examples/companion_radio/ui-new/UITask.cpp
examples/companion_radio/ui-orig/UITask.cpp
src/helpers/radiolib/CustomSX1262Wrapper.h
src/helpers/radiolib/RadioLibWrappers.h
@ -650,6 +650,7 @@ void UITask::shutdown(bool restart){
_board - > reboot ( ) ;
_board - > reboot ( ) ;
} else {
} else {
_display - > turnOff ( ) ;
_display - > turnOff ( ) ;
radio_driver . powerOff ( ) ;
_board - > powerOff ( ) ;
_board - > powerOff ( ) ;
}
}
}
}
@ -292,10 +292,12 @@ void UITask::shutdown(bool restart){
# endif // PIN_BUZZER
# endif // PIN_BUZZER
if ( restart )
if ( restart ) {
_board - > reboot ( ) ;
_board - > reboot ( ) ;
else
} else {
radio_driver . powerOff ( ) ;
_board - > powerOff ( ) ;
_board - > powerOff ( ) ;
}
}
}
void UITask : : loop ( ) {
void UITask : : loop ( ) {
@ -19,4 +19,7 @@ public:
int sf = ( ( CustomSX1262 * ) _radio ) - > spreadingFactor ;
int sf = ( ( CustomSX1262 * ) _radio ) - > spreadingFactor ;
return packetScoreInt ( snr , sf , packet_len ) ;
return packetScoreInt ( snr , sf , packet_len ) ;
}
}
virtual void powerOff ( ) override {
( ( CustomSX1262 * ) _radio ) - > sleep ( false ) ;
}
} ;
} ;
@ -21,6 +21,7 @@ public:
RadioLibWrapper ( PhysicalLayer & radio , mesh : : MainBoard & board ) : _radio ( & radio ) , _board ( & board ) { n_recv = n_sent = 0 ; }
RadioLibWrapper ( PhysicalLayer & radio , mesh : : MainBoard & board ) : _radio ( & radio ) , _board ( & board ) { n_recv = n_sent = 0 ; }
void begin ( ) override ;
void begin ( ) override ;
virtual void powerOff ( ) { _radio - > sleep ( ) ; }
int recvRaw ( uint8_t * bytes , int sz ) override ;
int recvRaw ( uint8_t * bytes , int sz ) override ;
uint32_t getEstAirtimeFor ( int len_bytes ) override ;
uint32_t getEstAirtimeFor ( int len_bytes ) override ;
bool startSendRaw ( const uint8_t * bytes , int len ) override ;
bool startSendRaw ( const uint8_t * bytes , int len ) override ;