diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-11-13 15:30:11 -0500 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-11-13 15:30:11 -0500 |
commit | 6c0c3baa0a8ba0ddb4dab767c75e10613768995f (patch) | |
tree | a12e5c6e65566a205655f655254ec9481f2e834b /device-functions.c | |
parent | 2f2aa1e39d806c2e3ffa1ecf6cd8d8f49cb25326 (diff) |
remove more fixed-length strings
Diffstat (limited to 'device-functions.c')
-rw-r--r-- | device-functions.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/device-functions.c b/device-functions.c index 6381f59..f2b3cd3 100644 --- a/device-functions.c +++ b/device-functions.c @@ -3945,8 +3945,9 @@ int go_cal(CalStruct *caldata) int i, status, points; float meas, nom_val, change; float min_val, max_val, chk_val; - char lcd_msg[LCD_cols+1]; - char prefix[LCD_cols+1]; + + gchar *lcd_msg = NULL; + gchar *prefix = NULL; points = Get_VI_Num_Pnts(caldata->cal_type,caldata->channel); @@ -3981,14 +3982,16 @@ int go_cal(CalStruct *caldata) LCD_write(0,0,"Self-calibration in progress."); if (caldata->cal_type == pwl_period_values) { - sprintf (prefix, "CH%d PER %d:",caldata->channel+1,i); + prefix = g_strdup_printf ("CH%d PER %d:",caldata->channel+1,i); } else if (caldata->cal_type == pwl_pw_values) { - sprintf (prefix, "CH%d PW %d:",caldata->channel+1,i); + prefix = g_strdup_printf ("CH%d PW %d:",caldata->channel+1,i); } else if (caldata->cal_type == pwl_delay_values) { - sprintf (prefix, "CH%d DLY %d:",caldata->channel+1,i); + prefix = g_strdup_printf ("CH%d DLY %d:",caldata->channel+1,i); } - sprintf (lcd_msg, "%s %.3e",prefix,nom_val); + + lcd_msg = g_strdup_printf ("%s %.3e",prefix,nom_val); LCD_write(2,0,lcd_msg); + g_free (lcd_msg); if (caldata->cal_type == pwl_period_values) { I2C_Self_Cal (caldata->channel, MEAS_PRF, &meas, 1.0 / globals.ChannelState[caldata->channel].frequency); @@ -4012,10 +4015,17 @@ int go_cal(CalStruct *caldata) LCD_clear(); LCD_write(0,0,"Self-calibration in progress."); - sprintf (lcd_msg, "%s %.3e -> %.3e",prefix,nom_val,meas); + + lcd_msg = g_strdup_printf ("%s %.3e -> %.3e",prefix,nom_val,meas); LCD_write(2,0,lcd_msg); - sprintf (lcd_msg, "changed %6.2f%%, err: %d",change,status); + g_free (lcd_msg); + + lcd_msg = g_strdup_printf ("changed %6.2f%%, err: %d",change,status); LCD_write(3,0,lcd_msg); + g_free (lcd_msg); + + g_free (prefix); + g_usleep (2e6); } } |