|
@@ -645,17 +645,26 @@ static int chargingcapabilityHandle(uint8_t *data, uint8_t gunID)
|
|
|
pCapabilityInfo = (CapabilityInfo *)&data[0];
|
|
|
|
|
|
MaxVolt = (float)(ntohs(pCapabilityInfo->OutputVoltage));
|
|
|
- if ((MaxVolt >= 0) && (MaxVolt <= MAX_VOLTAGE)) {
|
|
|
+ if (MaxVolt >= 0) {
|
|
|
+ if (MaxVolt > MAX_VOLTAGE) {
|
|
|
+ MaxVolt = MAX_VOLTAGE;
|
|
|
+ }
|
|
|
ChargingData[gunID]->MaximumChargingVoltage = MaxVolt;
|
|
|
}
|
|
|
|
|
|
MaxCurrent = (float)(ntohs(pCapabilityInfo->OutputCurrent));
|
|
|
- if ((MaxCurrent >= 0) && (MaxCurrent <= MAX_CURRENCY)) {
|
|
|
+ if (MaxCurrent >= 0) {
|
|
|
+ if (MaxCurrent > MAX_CURRENCY) {
|
|
|
+ MaxCurrent = MAX_CURRENCY;
|
|
|
+ }
|
|
|
ChargingData[gunID]->AvailableChargingCurrent = MaxCurrent;
|
|
|
}
|
|
|
|
|
|
MaxPower = (float)(ntohs(pCapabilityInfo->OutputPower));
|
|
|
- if ((MaxPower >= 0) && (MaxPower <= MAX_POWER)) {
|
|
|
+ if (MaxPower >= 0) {
|
|
|
+ if (MaxPower > MAX_POWER) {
|
|
|
+ MaxPower = MAX_POWER;
|
|
|
+ }
|
|
|
ChargingData[gunID]->AvailableChargingPower = MaxPower;
|
|
|
}
|
|
|
//MaxVolt = (float)(data[0] << 8 |data[1]);
|