From 111e8897be79f4c99734e77d0c389612f14a8e50 Mon Sep 17 00:00:00 2001 From: Nayan Date: Mon, 23 Feb 2026 22:23:08 -0500 Subject: [PATCH] models: fix default & index "0" (#1718) * default be gone * zero is the most significant number, don't ignore it. * thanks sentry!! --- common/params_keys.h | 2 +- sunnypilot/models/manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/params_keys.h b/common/params_keys.h index 6f27d9582d..8f3ee858f0 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -190,7 +190,7 @@ inline static std::unordered_map keys = { // Model Manager params {"ModelManager_ActiveBundle", {PERSISTENT, JSON}}, {"ModelManager_ClearCache", {CLEAR_ON_MANAGER_START, BOOL}}, - {"ModelManager_DownloadIndex", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, INT, "0"}}, + {"ModelManager_DownloadIndex", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, INT}}, {"ModelManager_Favs", {PERSISTENT | BACKUP, STRING}}, {"ModelManager_LastSyncTime", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, INT, "0"}}, {"ModelManager_ModelsCache", {PERSISTENT | BACKUP, JSON}}, diff --git a/sunnypilot/models/manager.py b/sunnypilot/models/manager.py index 2d3d670bfd..8fee0798b6 100644 --- a/sunnypilot/models/manager.py +++ b/sunnypilot/models/manager.py @@ -171,7 +171,7 @@ class ModelManagerSP: self.available_models = self.model_fetcher.get_available_bundles() self.active_bundle = get_active_bundle(self.params) - if index_to_download := self.params.get("ModelManager_DownloadIndex"): + if (index_to_download := self.params.get("ModelManager_DownloadIndex")) is not None: if model_to_download := next((model for model in self.available_models if model.index == index_to_download), None): try: self.download(model_to_download, Paths.model_root())