Fix display (#2)
This commit is contained in:
parent
387ff53369
commit
aa5910119c
@ -45,11 +45,8 @@ static const char* const i18n_date_format[] = { "%m/%d/%Y %H:%M", "%d.%m.%Y %H:%
|
||||
static const char* const i18n_powermeter_power_w[] = { "%c %.0f W", "%c %.0f W", "%c %.0f W" };
|
||||
static const char* const i18n_powermeter_power_kw[] = { "%c %.1f kW", "%c %.1f kW", "%c %.1f kW" };
|
||||
|
||||
static const char* const i18n_pm_positive_today_wh[] = { "In: %4.0f Wh", "In: %4.0f Wh", "In: %4.0f Wh" };
|
||||
static const char* const i18n_pm_positive_today_kwh[] = { "In: %.1f kWh", "In: %.1f kWh", "In: %.1f kWh" };
|
||||
|
||||
static const char* const i18n_pm_negative_today_wh[] = { "Out: %4.0f Wh", "Out: %4.0f Wh", "Out: %4.0f Wh" };
|
||||
static const char* const i18n_pm_negative_today_kwh[] = { "Out: %.1f kWh", "Out: %.1f kWh", "Out: %.1f kWh" };
|
||||
static const char* const i18n_pm_positive_today_kwh[] = { "In: %.2f kWh", "In: %.2f kWh", "In: %.2f kWh" };
|
||||
static const char* const i18n_pm_negative_today_kwh[] = { "Out: %.2f kWh", "Out: %.2f kWh", "Out: %.2f kWh" };
|
||||
|
||||
DisplayGraphicClass::DisplayGraphicClass()
|
||||
: _loopTask(TASK_IMMEDIATE, TASK_FOREVER, std::bind(&DisplayGraphicClass::loop, this))
|
||||
@ -272,20 +269,12 @@ void DisplayGraphicClass::loop()
|
||||
if (displayPowerMeter) {
|
||||
// Daily Input
|
||||
float wattsInput = JsyMk.getFieldValue(0, JsyMkClass::Field_t::TODAY_POSITIVE_ENERGY);
|
||||
if (wattsInput > 999) {
|
||||
snprintf(_fmtText, sizeof(_fmtText), i18n_pm_positive_today_kwh[_display_language], wattsInput / 1000);
|
||||
} else {
|
||||
snprintf(_fmtText, sizeof(_fmtText), i18n_pm_positive_today_wh[_display_language], wattsInput);
|
||||
}
|
||||
snprintf(_fmtText, sizeof(_fmtText), i18n_pm_positive_today_kwh[_display_language], wattsInput);
|
||||
printText(_fmtText, 1);
|
||||
|
||||
// Daily Output
|
||||
float wattsOutput = JsyMk.getFieldValue(0, JsyMkClass::Field_t::TODAY_POSITIVE_ENERGY);
|
||||
if (wattsOutput > 999) {
|
||||
snprintf(_fmtText, sizeof(_fmtText), i18n_pm_negative_today_kwh[_display_language], wattsOutput / 1000);
|
||||
} else {
|
||||
snprintf(_fmtText, sizeof(_fmtText), i18n_pm_negative_today_wh[_display_language], wattsOutput);
|
||||
}
|
||||
float wattsOutput = JsyMk.getFieldValue(0, JsyMkClass::Field_t::TODAY_NEGATIVE_ENERGY);
|
||||
snprintf(_fmtText, sizeof(_fmtText), i18n_pm_negative_today_kwh[_display_language], wattsOutput);
|
||||
printText(_fmtText, 2);
|
||||
} else {
|
||||
// Daily production
|
||||
|
||||
@ -194,10 +194,10 @@ float JsyMkClass::getFieldValue(size_t channel, Field_t fieldId) const
|
||||
return (config.PowerMeter.channel[channel].InvertDirection ? _jsymk.getPositiveEnergy() : _jsymk.getNegativeEnergy());
|
||||
|
||||
case Field_t::TODAY_POSITIVE_ENERGY:
|
||||
return (config.PowerMeter.channel[channel].InvertDirection ? _jsymk.getNegativeEnergy() - _todayNegativeRef : _jsymk.getPositiveEnergy() - _todayPositiveRef);
|
||||
return (config.PowerMeter.channel[channel].InvertDirection ? (_jsymk.getNegativeEnergy() - _todayNegativeRef) : (_jsymk.getPositiveEnergy() - _todayPositiveRef));
|
||||
|
||||
case Field_t::TODAY_NEGATIVE_ENERGY:
|
||||
return (config.PowerMeter.channel[channel].InvertDirection ? _jsymk.getPositiveEnergy() - _todayPositiveRef : _jsymk.getNegativeEnergy() - _todayNegativeRef);
|
||||
return (config.PowerMeter.channel[channel].InvertDirection ? (_jsymk.getPositiveEnergy() - _todayPositiveRef) : (_jsymk.getNegativeEnergy() - _todayNegativeRef));
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user