Fix bad memory alloaction in sysinfo screen.

This commit is contained in:
JF 2020-03-22 12:14:38 +01:00
parent fb64ba8fb6
commit 7e9a7e4d5f
2 changed files with 8 additions and 14 deletions

View File

@ -16,7 +16,7 @@ ScreenList::ScreenList(Pinetime::Applications::DisplayApp *app, Pinetime::Contro
// TODO all of this is far too heavy (string processing). This should be improved.
// TODO the info (battery, time,...) should be updated in the Refresh method.
char t1[200];
auto batteryPercent = static_cast<int16_t>(batteryController.PercentRemaining());
if(batteryPercent > 100) batteryPercent = 100;
@ -57,23 +57,13 @@ ScreenList::ScreenList(Pinetime::Applications::DisplayApp *app, Pinetime::Contro
dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(),
dateTimeController.Day(), dateTimeController.Month(), dateTimeController.Year(),
batteryPercent, brightness, resetReason);
/*
auto t1 = "Pinetime\n"
"Version:\n"
"Build: 23/03/2020\n"
"Time: 17:23:12\n"
"date: 23/03/2020\n"
"Uptime: 2d 13h52:21\n"
"Battery: 3.56v/82%\n"
"Backlight: 2/3\n"
"Last reset: wtdg\n"
"BLE MAC: \n AA:BB:CC:DD:EE:FF";*/
screens.emplace_back(t1);
auto t2 = "Hello from\nthe developper!";
strncpy(t2, "Hello from\nthe developper!", 27);
screens.emplace_back(t2);
auto t3 = "Place holder\nin case we need\nmore room!";
strncpy(t3, "Place holder\nin case we need\nmore room!", 40);
screens.emplace_back(t3);
auto &screen = screens[screenIndex];

View File

@ -28,6 +28,10 @@ namespace Pinetime {
Pinetime::Controllers::Battery& batteryController;
Pinetime::Controllers::BrightnessController& brightnessController;
Pinetime::Drivers::WatchdogView& watchdog;
char t1[200];
char t2[30];
char t3[42];
};
}
}