/* STORAGE OF SETTINGS */
/*
-Copyright 2021 Balthasar Szczepański
+Copyright 2021, 2024 Balthasar Szczepański
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// debug_string("FS LOAD PAGE\r\n",1);
+ if (new_page >= N_PAGES)
+ {
+ // debug_string("wrong page ID\r\n",1);
+ return;
+ }
+
if (new_page == fs_page)
{
// debug_string("no change\r\n",1);
/* STORAGE OF SETTINGS */
/*
-Copyright 2021 Balthasar Szczepański
+Copyright 2021, 2024 Balthasar Szczepański
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*/
#define N_SECTORS 256
-#define N_PAGES 256
+#define N_PAGES 250
#define N_FILES_IN_SECTOR 8
#define N_FILES_ON_PAGE 6
#define N_INDEX_RECORDS 170
/* This is a tradeoff between efficiency of memory space usage
and frequency of defragmentation.
With bigger value we're erasing and relocating less often,
-which extends the life of the flash memorym
+which extends the life of the flash memory,
but we are wasting more space for deleted files.
With the value of 2, even in the worst case, where each sector
contains 2 deleted files we still have place for (8-2)*256=1536 files,
ETAA: How about limit the number of pages to 250,
which gives 1500 settings only?
+
+ETAAA: Yes, we go with 250 pages now.
*/
#define RECORD_OFFSET_ID 0
/* GUI */
/*
-Copyright 2021, 2022 Balthasar Szczepański
+Copyright 2021, 2022, 2024 Balthasar Szczepański
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
else if((event & EVENT_BITS) == EVENT_JOG)
{
if ((event & ~EVENT_BITS) == JOG_PLUS)
- ++gui_page;
+ {
+ if (gui_page < (N_PAGES - 1))
+ ++gui_page;
+ else
+ gui_page = 0;
+ }
else
- --gui_page;
+ {
+ if (gui_page > 0)
+ --gui_page;
+ else
+ gui_page = N_PAGES - 1;
+ }
draw_select();
reject_gui_events();
}
else if((event & EVENT_BITS) == EVENT_JOG)
{
if ((event & ~EVENT_BITS) == JOG_PLUS)
- ++gui_page;
+ {
+ if (gui_page < (N_PAGES - 1))
+ ++gui_page;
+ else
+ gui_page = 0;
+ }
else
- --gui_page;
+ {
+ if (gui_page > 0)
+ --gui_page;
+ else
+ gui_page = N_PAGES - 1;
+ }
draw_select_save();
reject_gui_events();
}