This commit is contained in:
minacode 2022-12-08 20:43:47 +01:00
parent 5af0a3410d
commit cacf107c11
2 changed files with 27 additions and 47 deletions

View file

@ -2,10 +2,8 @@
#include <cmath>
#include <libraries/log/nrf_log.h>
using namespace Pinetime::Applications::Screens;
static void eventHandler(lv_obj_t* obj, lv_event_t event) {
auto app = static_cast<Calculator*>(obj->user_data);
app->OnButtonEvent(obj, event);
@ -15,12 +13,7 @@ Calculator::~Calculator() {
lv_obj_clean(lv_scr_act());
}
static const char* buttonMap[] = {
"7", "8", "9", "<", "\n",
"4", "5", "6", "+-", "\n",
"1", "2", "3", "*/", "\n",
".", "0", "=", "^", ""
};
static const char* buttonMap[] = {"7", "8", "9", "<", "\n", "4", "5", "6", "+-", "\n", "1", "2", "3", "*/", "\n", ".", "0", "=", "^", ""};
Calculator::Calculator(DisplayApp* app) : Screen(app) {
resultLabel = lv_label_create(lv_scr_act(), nullptr);
@ -186,13 +179,7 @@ void Calculator::UpdateResultLabel() {
padding++;
}
lv_label_set_text_fmt(
resultLabel,
"%ld.%0*u",
integer,
padding,
printRemainder
);
lv_label_set_text_fmt(resultLabel, "%ld.%0*u", integer, padding, printRemainder);
}
void Calculator::UpdateValueLabel() {
@ -223,13 +210,7 @@ void Calculator::UpdateValueLabel() {
} else if ((offset == FIXED_POINT_OFFSET / 10) && (remainder == 0)) {
lv_label_set_text_fmt(valueLabel, "%ld.", integer);
} else {
lv_label_set_text_fmt(
valueLabel,
"%ld.%0*u",
integer,
padding,
printRemainder
);
lv_label_set_text_fmt(valueLabel, "%ld.%0*u", integer, padding, printRemainder);
}
}

View file

@ -2,7 +2,6 @@
#include "Screen.h"
namespace Pinetime {
namespace Applications {
namespace Screens {