Skip to content

Commit

Permalink
Remove superfluous float castings
Browse files Browse the repository at this point in the history
  • Loading branch information
MCUdude committed Jul 18, 2023
1 parent b25cfcc commit 73499c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/jtag3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp) {
else {
if (analog_raw_data & 0x0800)
analog_raw_data |= 0xF000;
fmsg_out(fp, "%sVout measured : %.02f V\n", p, (float) analog_raw_data / -200.0);
fmsg_out(fp, "%sVout measured : %.02f V\n", p, analog_raw_data / -200.0);
}

// Read channel A voltage
Expand All @@ -2633,7 +2633,7 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp) {
else {
if (analog_raw_data & 0x0800)
analog_raw_data |= 0xF000;
fmsg_out(fp, "%sCh A voltage : %.03f V\n", p, (float) analog_raw_data / -200.0);
fmsg_out(fp, "%sCh A voltage : %.03f V\n", p, analog_raw_data / -200.0);
}

// Read channel A current
Expand All @@ -2643,7 +2643,7 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp) {
if (buf[0] != 0x90)
pmsg_error("invalid PARM3_ANALOG_A_CURRENT data packet format\n");
else
fmsg_out(fp, "%sCh A current : %.3f mA\n", p, (float) analog_raw_data * 0.003472);
fmsg_out(fp, "%sCh A current : %.3f mA\n", p, analog_raw_data * 0.003472);

// Read channel B voltage
if (jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_ANALOG_B_VOLTAGE, buf, 2) < 0)
Expand All @@ -2654,7 +2654,7 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp) {
else {
if (analog_raw_data & 0x0800)
analog_raw_data |= 0xF000;
fmsg_out(fp, "%sCh B voltage : %.03f V\n", p, (float) analog_raw_data / -200.0);
fmsg_out(fp, "%sCh B voltage : %.03f V\n", p, analog_raw_data / -200.0);
}

// Read channel B current
Expand All @@ -2666,7 +2666,7 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp) {
else {
if (analog_raw_data & 0x0800)
analog_raw_data |= 0xF000;
fmsg_out(fp, "%sCh B current : %.3f mA\n", p, (float) analog_raw_data * 0.555556);
fmsg_out(fp, "%sCh B current : %.3f mA\n", p, analog_raw_data * 0.555556);
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/stk500v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3701,7 +3701,7 @@ static void stk500v2_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp
case PGMTYPE_JTAGICE_MKII:
stk500v2_getparm(pgm, PARAM_SCK_DURATION, &sck_duration);
fmsg_out(fp, "%sSCK period : %.2f us\n", p,
(float) 1000000 / avrispmkIIfreqs[sck_duration]);
1000000 / avrispmkIIfreqs[sck_duration]);
break;

case PGMTYPE_JTAGICE3:
Expand Down Expand Up @@ -3731,7 +3731,7 @@ static void stk500v2_print_parms1(const PROGRAMMER *pgm, const char *p, FILE *fp
fmsg_out(fp, "%sVaref 1 : %.2f V\n", p, varef / 100.0);
}
stk500v2_getparm2(pgm, PARAM2_SCK_DURATION, &sck_stk600);
fmsg_out(fp, "%sSCK period : %.2f us\n", p, (float) (sck_stk600 + 1) / 8.0);
fmsg_out(fp, "%sSCK period : %.2f us\n", p, (sck_stk600 + 1) / 8.0);
if (pgm->extra_features & HAS_FOSC_ADJ) {
stk500v2_getparm2(pgm, PARAM2_CLOCK_CONF, &clock_conf);
oct = (clock_conf & 0xf000) >> 12u;
Expand Down

0 comments on commit 73499c0

Please sign in to comment.