es519xx: apply the proper fixed factor in duty cycle mode

This commit is contained in:
Aurelien Jacobs 2013-12-29 17:14:37 +01:00 committed by Uwe Hermann
parent e1f9f1e1f2
commit c3e871dc8e
1 changed files with 4 additions and 0 deletions

View File

@ -169,6 +169,8 @@ static int parse_range(uint8_t b, float *floatval,
mode = 7; /* Capacitance */ mode = 7; /* Capacitance */
else if (info->is_diode) else if (info->is_diode)
mode = 8; /* Diode */ mode = 8; /* Diode */
else if (info->is_duty_cycle)
mode = 0; /* Dummy, unused */
else { else {
sr_dbg("Invalid mode, range byte was: 0x%02x.", b); sr_dbg("Invalid mode, range byte was: 0x%02x.", b);
return SR_ERR; return SR_ERR;
@ -180,6 +182,8 @@ static int parse_range(uint8_t b, float *floatval,
else if (info->is_milli) else if (info->is_milli)
factor = (const float[]){1e-2, 1e-1}[idx]; factor = (const float[]){1e-2, 1e-1}[idx];
} }
else if (info->is_duty_cycle)
factor = 1e-1;
else if (info->baudrate == 2400) else if (info->baudrate == 2400)
factor = factors_2400_11b[mode][idx]; factor = factors_2400_11b[mode][idx];
else if (info->fivedigits) else if (info->fivedigits)