reduce warnings amount

This commit is contained in:
Milos Kozak 2021-06-26 19:53:09 +02:00
parent 71ada7203a
commit 62cb1bb506
2 changed files with 5 additions and 2 deletions

View file

@ -134,7 +134,10 @@ class ConfigBuilderPlugin @Inject constructor(
// Ask when switching to physical pump plugin
fun switchAllowed(changedPlugin: PluginBase, newState: Boolean, activity: FragmentActivity?, type: PluginType) {
if (changedPlugin.getType() == PluginType.PUMP && changedPlugin.name != resourceHelper.gs(R.string.virtualpump)) confirmPumpPluginActivation(changedPlugin, newState, activity, type) else performPluginSwitch(changedPlugin, newState, type)
if (changedPlugin.getType() == PluginType.PUMP && changedPlugin.name != resourceHelper.gs(R.string.virtualpump))
confirmPumpPluginActivation(changedPlugin, newState, activity, type)
else if (changedPlugin.getType() == PluginType.PUMP) pumpSync.connectNewPump()
else performPluginSwitch(changedPlugin, newState, type)
}
private fun confirmPumpPluginActivation(changedPlugin: PluginBase, newState: Boolean, activity: FragmentActivity?, type: PluginType) {

View file

@ -68,7 +68,7 @@ class PumpSyncImplementation @Inject constructor(
return true
}
if (type.description != storedType || serialNumber != storedSerial)
if ((type.description != storedType || serialNumber != storedSerial) && timestamp >= storedTimestamp)
rxBus.send(EventNewNotification(Notification(Notification.WRONG_PUMP_DATA, resourceHelper.gs(R.string.wrong_pump_data), Notification.URGENT)))
aapsLogger.error(LTag.PUMP, "Ignoring pump history record Allowed: ${dateUtil.dateAndTimeAndSecondsString(storedTimestamp)} $storedType $storedSerial Received: $timestamp ${dateUtil.dateAndTimeAndSecondsString(timestamp)} ${type.description} $serialNumber")
return false