mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 23:21:53 +02:00
format
This commit is contained in:
parent
5af0a3410d
commit
cacf107c11
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "Screen.h"
|
||||
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
|
|
Loading…
Reference in a new issue