Memory savings by replacing strings

This commit is contained in:
Riku Isokoski
2021-10-29 13:10:34 +03:00
parent 71ce13d309
commit 30520d262b
2 changed files with 21 additions and 17 deletions

View File

@@ -1,10 +1,10 @@
#include "Twos.h"
#include <lvgl/lvgl.h>
#include <string>
#include <charconv>
#include <array>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <lvgl/lvgl.h>
#include <utility>
#include <vector>
using namespace Pinetime::Applications::Screens;
@@ -265,7 +265,9 @@ void Twos::updateGridDisplay(Tile grid[][4]) {
for (int row = 0; row < 4; row++) {
for (int col = 0; col < 4; col++) {
if (grid[row][col].value) {
lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
char buffer[7];
sprintf(buffer, "%d", grid[row][col].value);
lv_table_set_cell_value(gridDisplay, row, col, buffer);
} else {
lv_table_set_cell_value(gridDisplay, row, col, "");
}