Better implementation
This commit is contained in:
@@ -30,6 +30,31 @@
|
|||||||
#define SWITCH_TYPE_MAX(sw) (SWITCH_3POS)
|
#define SWITCH_TYPE_MAX(sw) (SWITCH_3POS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class RTCBattValue: public StaticText
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RTCBattValue(Window * parent, const rect_t & rect):
|
||||||
|
StaticText(parent, rect)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkEvents() override
|
||||||
|
{
|
||||||
|
div_t qr = div(getRTCBatteryVoltage(), 100);
|
||||||
|
char * tmp;
|
||||||
|
tmp = strAppendUnsigned(reusableBuffer.hardwareAndSettings.msg, qr.quot);
|
||||||
|
tmp = strAppend(tmp, ".", 1);
|
||||||
|
tmp = strAppendUnsigned(tmp, qr.rem, 2);
|
||||||
|
tmp = strAppend(tmp, " V", 2);
|
||||||
|
if (text != reusableBuffer.hardwareAndSettings.msg) {
|
||||||
|
setText(reusableBuffer.hardwareAndSettings.msg);
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
class SwitchDynamicLabel : public StaticText {
|
class SwitchDynamicLabel : public StaticText {
|
||||||
public:
|
public:
|
||||||
SwitchDynamicLabel(Window * parent, const rect_t & rect, uint8_t index):
|
SwitchDynamicLabel(Window * parent, const rect_t & rect, uint8_t index):
|
||||||
@@ -154,15 +179,8 @@ void RadioHardwarePage::build(FormWindow * window)
|
|||||||
|
|
||||||
// RTC Batt display
|
// RTC Batt display
|
||||||
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT);
|
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT);
|
||||||
div_t qr = div(getRTCBatteryVoltage(), 100);
|
|
||||||
//sprintf(reusableBuffer.hardwareAndSettings.msg, "%d.%02d V", qr.quot, qr.rem);
|
new RTCBattValue(window, grid.getFieldSlot());
|
||||||
char * tmp;
|
|
||||||
tmp = strAppendUnsigned(reusableBuffer.hardwareAndSettings.msg, qr.quot);
|
|
||||||
tmp = strAppend(tmp,".",1);
|
|
||||||
tmp = strAppendUnsigned(tmp, qr.rem, 2);
|
|
||||||
tmp = strAppend(tmp, " V", 2);
|
|
||||||
auto rtc = new StaticText(window, grid.getFieldSlot(), reusableBuffer.hardwareAndSettings.msg);
|
|
||||||
rtc->setWindowFlags(REFRESH_ALWAYS);
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
// RTC Batt check enable
|
// RTC Batt check enable
|
||||||
|
|||||||
Reference in New Issue
Block a user