I have an embedded system (MCU without any OS) that the end user should be able to determine the system level (scale: 0-100) for a year. As an example (time x day matrix):
| 1st Jan | 2nd Jan | 3rd Jan | .. | 31 Dec | 00:30 | 40 (%) | 40 | 45 | .. | 50 | 01:48 | 48 | 47 | 55 | .. | 33 | 02:26 | 64 | 64 | 60 | .. | 68 | .. | .. | .. | .. | .. | .. | 22:15 | 79 | 82 | 89 | .. | 100 | 23:37 | 100 | 100 | 97 | .. | 100 |
I thought of storing the data as: time [in minutes], sysLevel so for the above table it would be something like this:
typedef struct{ uint16_t minute;
then save every day as
timeLevel_t firstJan[24] = { .. };
(I will extract the data from the CSV file, which may be off topic, to consider it now on this issue).
In the worst case, the system will determine the definition of the task per hour, so the definition of timeLevel_t (3 bytes) for 24 hours will be 72 bytes per day, then the data for 365 days will be 26,280 bytes of data.
Would you suggest a more efficient memory storage algorithm for storing a calendar year (the program will update it every year to be reviewed on February 29)?
Moreover? Would it be better to make a 2-dimensional array for storing daily information on 1D, and timeLevel_t for another dimension?
source share