Skip to content

Commit

Permalink
fix randomBG scaling for 1 minute CGM interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ga-zelle committed Mar 2, 2024
1 parent 9f3ae4e commit 1897694
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class RandomBgPlugin @Inject constructor(

val cal = GregorianCalendar()
val currentMinute = cal[Calendar.MINUTE] + (cal[Calendar.HOUR_OF_DAY] % 2) * 60
val bgMgdl = min + ((max - min) + (max - min) * sin(currentMinute / period * 2 * PI)) / 2 + (SecureRandom().nextDouble() - 0.5) * (max - min) * 0.4
val bgMgdl = min + ((max - min) + (max - min) * sin(currentMinute / period * 2 * PI)) / 2 + (SecureRandom().nextDouble() - 0.5) * (max - min) * 0.08 * interval.toDouble()

cal[Calendar.MILLISECOND] = 0
cal[Calendar.SECOND] = 0
Expand Down

0 comments on commit 1897694

Please sign in to comment.