Skip to content
Snippets Groups Projects
Commit 63635163 authored by Tobias Kahlki's avatar Tobias Kahlki Committed by Jonas Höppner
Browse files

[CMD][EEPROM] Change output of get function

parent 25e94b51
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,18 @@ ...@@ -21,7 +21,18 @@
/* /*
* Command Functions * Command Functions
*/ */
static void do_seco_eeprom_manager_get(const u8 uid, const bool set_env)
/*
* 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)
{ {
u8 panel_id = 0, touch_id = 0; u8 panel_id = 0, touch_id = 0;
...@@ -31,10 +42,9 @@ static void do_seco_eeprom_manager_get(const u8 uid, const bool set_env) ...@@ -31,10 +42,9 @@ static void do_seco_eeprom_manager_get(const u8 uid, const bool set_env)
if (seco_eeprom_get_panel_id(&panel_id) == 0 && panel_id != 0) if (seco_eeprom_get_panel_id(&panel_id) == 0 && panel_id != 0)
{ {
panel_id -= '0'; panel_id -= '0';
env_set_ulong(ENV_PANEL_ID, panel_id);
if (set_env) if (print)
env_set_ulong(ENV_PANEL_ID, panel_id);
else
printf("panel_id: %d\n", panel_id); printf("panel_id: %d\n", panel_id);
} }
break; break;
...@@ -43,17 +53,16 @@ static void do_seco_eeprom_manager_get(const u8 uid, const bool set_env) ...@@ -43,17 +53,16 @@ static void do_seco_eeprom_manager_get(const u8 uid, const bool set_env)
if(seco_eeprom_get_touch_id(&touch_id) == 0 && touch_id != 0) if(seco_eeprom_get_touch_id(&touch_id) == 0 && touch_id != 0)
{ {
touch_id -= '0'; touch_id -= '0';
env_set_ulong(ENV_TOUCH_ID, touch_id);
if (set_env) if (print)
env_set_ulong(ENV_TOUCH_ID, touch_id);
else
printf("touch_id: %d\n", touch_id); printf("touch_id: %d\n", touch_id);
} }
break; break;
default: default:
if (!set_env) if (print)
printf("Error: Unknown/Unsupported UID \"%02X\"\n", uid); printf("Error: Unknown/Unsupported UID \"0x%02X\"\n", uid);
} }
} }
...@@ -67,7 +76,7 @@ static void do_seco_eeprom_manager_env(void) ...@@ -67,7 +76,7 @@ static void do_seco_eeprom_manager_env(void)
u8 uid = 0; u8 uid = 0;
for (uid = 0; uid < UID_NONE; ++uid) for (uid = 0; uid < UID_NONE; ++uid)
do_seco_eeprom_manager_get(uid, true); do_seco_eeprom_manager_get(uid, false);
} }
static void do_seco_eeprom_manager_print(void) static void do_seco_eeprom_manager_print(void)
......
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