Move carbs_suggestions_threshold to LoopPlugin so that non-critical carbs still show on overview (but no system notification)

This commit is contained in:
Brian Quinion 2020-03-10 18:59:39 +00:00
parent b1097880f4
commit 72a3e825e3
2 changed files with 4 additions and 3 deletions

View file

@ -409,7 +409,9 @@ public class LoopPlugin extends PluginBase {
if (closedLoopEnabled.value()) { if (closedLoopEnabled.value()) {
if (allowNotification) { if (allowNotification) {
if (resultAfterConstraints.isCarbsRequired() && carbsSuggestionsSuspendedUntil < System.currentTimeMillis()) { if (resultAfterConstraints.isCarbsRequired()
&& resultAfterConstraints.carbsReq >= sp.getInt(R.string.key_smb_enable_carbs_suggestions_threshold, 0)
&& carbsSuggestionsSuspendedUntil < System.currentTimeMillis()) {
Intent intentAction5m = new Intent(context, CarbSuggestionReceiver.class); Intent intentAction5m = new Intent(context, CarbSuggestionReceiver.class);
intentAction5m.putExtra("ignoreDuration",5); intentAction5m.putExtra("ignoreDuration",5);

View file

@ -36,8 +36,7 @@ public class DetermineBasalResultSMB extends APSResult {
//if (result.has("insulinReq")) insulinReq = result.getDouble("insulinReq"); //if (result.has("insulinReq")) insulinReq = result.getDouble("insulinReq");
if (SP.getBoolean(R.string.key_smb_enable_carbs_suggestions, false)) { if (SP.getBoolean(R.string.key_smb_enable_carbs_suggestions, false)) {
if (result.has("carbsReq") && result.getInt("carbsReq") >= SP.getInt(R.string.key_smb_enable_carbs_suggestions_threshold, 0)) if (result.has("carbsReq")) carbsReq = result.getInt("carbsReq");
carbsReq = result.getInt("carbsReq");
if (result.has("carbsReqWithin")) carbsReqWithin = result.getInt("carbsReqWithin"); if (result.has("carbsReqWithin")) carbsReqWithin = result.getInt("carbsReqWithin");
} }