AutotuneConfigProvider.swift 771 B

1234567891011121314151617181920212223242526
  1. import Combine
  2. extension AutotuneConfig {
  3. final class Provider: BaseProvider, AutotuneConfigProvider {
  4. @Injected() private var apsManager: APSManager!
  5. var autotune: Autotune? {
  6. storage.retrieve(OpenAPS.Settings.autotune, as: Autotune.self)
  7. }
  8. var basalProfilePump: [BasalProfileEntry] {
  9. storage.retrieve(OpenAPS.Settings.basalProfile, as: [BasalProfileEntry].self)
  10. ?? [BasalProfileEntry](from: OpenAPS.defaults(for: OpenAPS.Settings.basalProfile))
  11. ?? []
  12. }
  13. func runAutotune() -> AnyPublisher<Autotune?, Never> {
  14. apsManager.autotune()
  15. }
  16. func deleteAutotune() {
  17. storage.remove(OpenAPS.Settings.autotune)
  18. }
  19. }
  20. }