Skip to content
Snippets Groups Projects
Commit 51a23110 authored by Jonas Höppner's avatar Jonas Höppner
Browse files

[LIB][EEPROM] Change the internal representation ids zero based integer

The values are stored as ascii in the eeprom (format V0.2, '0'-'9',
but as variables used on the code they should be plain integers.
In the future the representation in the eeprom may also change, and
until know the interface is not yet widely used, so a change can be
done.
parent 1ceb7a12
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ int print_ssect(struct eeprom_ssect *ssect)
break;
case UID_BOARD_PART_NUMBER:
printf("BPN: : %.4s-%.4s-%.4s-%.2s\n",
printf("BPN: : %.4s-%.4s-%.4s-%.2s\n",
(char*)(uid_data),
(char*)(uid_data+4),
(char*)(uid_data+8),
......@@ -309,7 +309,14 @@ int seco_eeprom_get_panel_id(u8 *panel_id)
if (g_eeprom_initialized == false)
return -1;
*panel_id = g_eeprom_data.panel_id;
/* Note: The panel_id and touch_id are currently stored in ASCII format.
* For example ID 1 has the numerical value of 0x31, 2 has the value of
* 0x32 and so on.
* For better handling, we subtract 0x30 (= '0') from the ID to get the
* numerical value.
*/
*panel_id = g_eeprom_data.panel_id - '0';
return 0;
}
......@@ -329,7 +336,7 @@ int seco_eeprom_get_touch_id(u8 *touch_id)
if (g_eeprom_initialized == false)
return -1;
*touch_id = g_eeprom_data.touch_id;
*touch_id = g_eeprom_data.touch_id - '0';
return 0;
}
......
......@@ -26,11 +26,6 @@
* Gets the supported UIDs from the EEPROM manager library and writes
* them to the environment and the stdout.
*
* Note: The panel_id and touch_id are currently stored in ASCII format.
* For example ID 1 has the numerical value of 0x31, 2 has the value of
* 0x32 and so on.
* For better handling, we subtract 0x30 (= '0') from the ID to get the
* numerical value.
*/
static void do_seco_eeprom_manager_get(const u8 uid, const bool print)
{
......@@ -41,7 +36,6 @@ static void do_seco_eeprom_manager_get(const u8 uid, const bool print)
case UID_PANEL_ID:
if (seco_eeprom_get_panel_id(&panel_id) == 0 && panel_id != 0)
{
panel_id -= '0';
env_set_ulong(ENV_PANEL_ID, panel_id);
if (print)
......@@ -52,7 +46,6 @@ static void do_seco_eeprom_manager_get(const u8 uid, const bool print)
case UID_TOUCH_ID:
if(seco_eeprom_get_touch_id(&touch_id) == 0 && touch_id != 0)
{
touch_id -= '0';
env_set_ulong(ENV_TOUCH_ID, touch_id);
if (print)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment