diff --git a/src/driver/drv_pwrCal.c b/src/driver/drv_pwrCal.c index 82a7fe951..0aebd8f91 100644 --- a/src/driver/drv_pwrCal.c +++ b/src/driver/drv_pwrCal.c @@ -30,6 +30,11 @@ static commandResult_t Calibrate(const char *cmd, const char *args, float raw, CMD_GetResultString(CMD_RES_BAD_ARGUMENT)); return CMD_RES_BAD_ARGUMENT; } +#define VERY_SMALL_VAL 0.001f + if (raw > -VERY_SMALL_VAL && raw < VERY_SMALL_VAL) { + ADDLOG_ERROR(LOG_FEATURE_ENERGYMETER, "Calibration incorrect - connect load first."); + } + *cal = (cal_type == PWR_CAL_MULTIPLY ? real / raw : raw / real); CFG_SetPowerMeasurementCalibrationFloat(cfg_index, *cal);