Merge remote-tracking branch 'Nightscout/dev2_dana_combo_only' into dev2_Insight_v2
This commit is contained in:
commit
8819859e7c
|
@ -192,7 +192,7 @@ abstract class PluginsModule {
|
||||||
abstract fun bindOpenAPSSMBPlugin(plugin: OpenAPSSMBPlugin): PluginBase
|
abstract fun bindOpenAPSSMBPlugin(plugin: OpenAPSSMBPlugin): PluginBase
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@NotNSClient
|
@AllConfigs
|
||||||
@IntoMap
|
@IntoMap
|
||||||
@IntKey(240)
|
@IntKey(240)
|
||||||
abstract fun bindLocalProfilePlugin(plugin: LocalProfilePlugin): PluginBase
|
abstract fun bindLocalProfilePlugin(plugin: LocalProfilePlugin): PluginBase
|
||||||
|
|
|
@ -279,7 +279,7 @@ class DataSyncSelectorImplementation @Inject constructor(
|
||||||
nsClientPlugin.nsClientService?.dbUpdate("entries", gv.first.interfaceIDs.nightscoutId, gv.first.toJson(dateUtil), DataSyncSelector.PairGlucoseValue(gv.first, gv.second))
|
nsClientPlugin.nsClientService?.dbUpdate("entries", gv.first.interfaceIDs.nightscoutId, gv.first.toJson(dateUtil), DataSyncSelector.PairGlucoseValue(gv.first, gv.second))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
} else confirmLastGlucoseValueIdIfGreater(gv.second)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ class DataSyncSelectorImplementation @Inject constructor(
|
||||||
nsClientPlugin.nsClientService?.dbUpdate("treatments", tb.first.interfaceIDs.nightscoutId, tb.first.toJson(profile, dateUtil), DataSyncSelector.PairTemporaryBasal(tb.first, tb.second))
|
nsClientPlugin.nsClientService?.dbUpdate("treatments", tb.first.interfaceIDs.nightscoutId, tb.first.toJson(profile, dateUtil), DataSyncSelector.PairTemporaryBasal(tb.first, tb.second))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
} ?: confirmLastTemporaryBasalIdIfGreater(tb.second)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ class DataSyncSelectorImplementation @Inject constructor(
|
||||||
nsClientPlugin.nsClientService?.dbUpdate("treatments", eb.first.interfaceIDs.nightscoutId, eb.first.toJson(profile, dateUtil), DataSyncSelector.PairExtendedBolus(eb.first, eb.second))
|
nsClientPlugin.nsClientService?.dbUpdate("treatments", eb.first.interfaceIDs.nightscoutId, eb.first.toJson(profile, dateUtil), DataSyncSelector.PairExtendedBolus(eb.first, eb.second))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
} ?: confirmLastExtendedBolusIdIfGreater(eb.second)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,7 @@ class LocalProfilePlugin @Inject constructor(
|
||||||
if (sp.getBoolean(R.string.key_ns_receive_profile_store, false) || config.NSCLIENT) {
|
if (sp.getBoolean(R.string.key_ns_receive_profile_store, false) || config.NSCLIENT) {
|
||||||
localProfilePlugin.loadFromStore(ProfileStore(injector, profileJson, dateUtil))
|
localProfilePlugin.loadFromStore(ProfileStore(injector, profileJson, dateUtil))
|
||||||
aapsLogger.debug(LTag.PROFILE, "Received profileStore: $profileJson")
|
aapsLogger.debug(LTag.PROFILE, "Received profileStore: $profileJson")
|
||||||
return Result.success(workDataOf("Data" to profileJson.toString()))
|
return Result.success(workDataOf("Data" to profileJson.toString().substring(1..5000)))
|
||||||
}
|
}
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,8 @@ open class VirtualPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isThisProfileSet(profile: Profile): Boolean {
|
override fun isThisProfileSet(profile: Profile): Boolean {
|
||||||
return true
|
val running = pumpSync.expectedPumpState().profile
|
||||||
|
return running?.isEqual(profile) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun lastDataTime(): Long {
|
override fun lastDataTime(): Long {
|
||||||
|
|
|
@ -145,6 +145,18 @@ sealed class ProfileSealed(
|
||||||
override val timeshift: Int
|
override val timeshift: Int
|
||||||
get() = ts
|
get() = ts
|
||||||
|
|
||||||
|
override fun isEqual(profile: Profile): Boolean {
|
||||||
|
for (hour in 0..23) {
|
||||||
|
val seconds = T.hours(hour.toLong()).secs().toInt()
|
||||||
|
if (getBasalTimeFromMidnight(seconds) != profile.getBasalTimeFromMidnight(seconds)) return false
|
||||||
|
if (getIsfMgdlTimeFromMidnight(seconds) != profile.getIsfMgdlTimeFromMidnight(seconds)) return false
|
||||||
|
if (getIcTimeFromMidnight(seconds) != profile.getIcTimeFromMidnight(seconds)) return false
|
||||||
|
if (getTargetLowMgdlTimeFromMidnight(seconds) != profile.getTargetLowMgdlTimeFromMidnight(seconds)) return false
|
||||||
|
if (getTargetHighMgdlTimeFromMidnight(seconds) != profile.getTargetHighMgdlTimeFromMidnight(seconds)) return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
override val percentage: Int
|
override val percentage: Int
|
||||||
get() = pct
|
get() = pct
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,11 @@ interface Profile {
|
||||||
*/
|
*/
|
||||||
val timeshift: Int
|
val timeshift: Int
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is equal to another profile?
|
||||||
|
*/
|
||||||
|
fun isEqual(profile: Profile): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basal value according to "now"
|
* Basal value according to "now"
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue