RandomBGPlugin - stay between min and max
The sinus is in interval [-1,1]. If we shift it by one interval it would map it to 0 to 2 times the interval -> divide by two.
This commit is contained in:
parent
9ed1a9ba69
commit
9995e7448b
1 changed files with 1 additions and 1 deletions
|
@ -79,7 +79,7 @@ class RandomBgPlugin @Inject constructor(
|
||||||
|
|
||||||
val cal = GregorianCalendar()
|
val cal = GregorianCalendar()
|
||||||
val currentMinute = cal.get(Calendar.MINUTE) + (cal.get(Calendar.HOUR_OF_DAY) % 2) * 60
|
val currentMinute = cal.get(Calendar.MINUTE) + (cal.get(Calendar.HOUR_OF_DAY) % 2) * 60
|
||||||
val bgMgdl = min + (max - min) + (max - min) * sin(currentMinute / 120.0 * 2 * PI)
|
val bgMgdl = min + ((max - min) + (max - min) * sin(currentMinute / 120.0 * 2 * PI))/2
|
||||||
|
|
||||||
val bgReading = BgReading()
|
val bgReading = BgReading()
|
||||||
bgReading.value = bgMgdl
|
bgReading.value = bgMgdl
|
||||||
|
|
Loading…
Reference in a new issue