Commit e5422de1 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

shell: migrated to new calibration parameter API, show/erase options in 'calibration' command added

parent 877b6c1e
......@@ -9,7 +9,7 @@
*/
/* Command: calibration
Arguments: [force]
Arguments: [show] [erase] [t24p]
Description: launches RX timestamper calibration. */
......@@ -23,25 +23,30 @@
static int cmd_calibration(const char *args[])
{
uint32_t trans;
wrc_cal_data_t* cal = storage_get_calibration_data();
if (args[0] && !strcasecmp(args[0], "force")) {
if (measure_t24p(&trans) < 0)
return -1;
return storage_phtrans(&trans, 1);
} else if (!args[0]) {
if (storage_phtrans(&trans, 0) > 0) {
pp_printf("Found phase transition in EEPROM: %dps\n",
trans);
cal_phase_transition = trans;
return 0;
} else {
pp_printf("Measuring t2/t4 phase transition...\n");
if (!args[0])
return -1;
if (!strcasecmp(args[0], "t24p")) {
pp_printf("Measuring t2/t4 phase transition...\n");
if (measure_t24p(&trans) < 0)
return -1;
cal_phase_transition = trans;
return storage_phtrans(&trans, 1);
return -1;
storage_set_calibration_parameter(CAL_PARAM_T24P, trans);
return storage_save_calibration();
} else if (!strcasecmp(args[0], "show")) {
int i;
pp_printf("Calibration parameters: \n");
for(i = 0; i < cal->param_count; i++)
{
pp_printf(" 0x%08x: %d\n", cal->params[i].id, cal->params[i].value );
}
}
} else if (!strcasecmp(args[0], "erase")) {
pp_printf("Erasing calibration parameters.\n");
cal->param_count = 0;
storage_save_calibration();
};
return 0;
}
......
......@@ -385,4 +385,6 @@ static void shell_register_commands()
REGISTER_WRC_COMMAND(mac);
REGISTER_WRC_COMMAND(ertm);
REGISTER_WRC_COMMAND(sfp);
}
\ No newline at end of file
REGISTER_WRC_COMMAND(sdb);
REGISTER_WRC_COMMAND(calibration);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment