Skip to content

Commit

Permalink
December 14th, 2024 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogAi committed Dec 15, 2024
1 parent 5159d11 commit 1042a55
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion selfdrive/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ def update(self, cp, cp_cam, CC, frogpilot_toggles):
fp_ret.ecoGear = cp.vl["GEAR_PACKET"]['ECON_ON'] == 1
fp_ret.sportGear = cp.vl["GEAR_PACKET"]['SPORT_ON_2' if self.CP.flags & ToyotaFlags.NO_DSU else 'SPORT_ON'] == 1

self.lkas_previously_enabled = self.lkas_enabled
if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V:
self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = self.lkas_hud.get("LDA_ON_MESSAGE") == 1

# ZSS Support - Credit goes to Erich!
Expand Down
7 changes: 6 additions & 1 deletion selfdrive/frogpilot/assets/theme_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ def validate_themes(self, frogpilot_toggles):
"WheelIcon": ("steering_wheels", frogpilot_toggles.wheel_image)
}

theme_downloaded = False
for theme_param, (theme_component, theme_name) in asset_mappings.items():
if theme_name in {"none", "stock"}:
continue
Expand All @@ -418,9 +419,13 @@ def validate_themes(self, frogpilot_toggles):
else:
theme_path = os.path.join(THEME_SAVE_PATH, "theme_packs", theme_name, theme_component)

if theme_path and not os.path.exists(theme_path):
if theme_path is None or not os.path.exists(theme_path):
print(f"{theme_name} for {theme_component} not found. Downloading...")
self.download_theme(theme_component, theme_name, theme_param)
theme_downloaded = True

if theme_downloaded:
update_frogpilot_toggles()

def update_themes(self, frogpilot_toggles, boot_run=False):
repo_url = get_repository_url()
Expand Down
12 changes: 10 additions & 2 deletions selfdrive/frogpilot/ui/qt/widgets/frogpilot_controls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ QColor loadThemeColors(const QString &colorKey, bool clearCache) {
cachedColorData = QJsonObject();
QFile file("../frogpilot/assets/active_theme/colors/colors.json");

while (!file.exists()) {
static int check_count = 0;
while (!file.exists() && check_count < 100) {
check_count += 1;
util::sleep_for(100);
}

file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly)) {
return QColor();
}

QByteArray fileData = file.readAll();
QJsonDocument doc = QJsonDocument::fromJson(fileData);

cachedColorData = doc.object();
}

if (cachedColorData.isEmpty()) {
return QColor();
}

QJsonObject colorObj = cachedColorData.value(colorKey).toObject();
return QColor(
colorObj.value("red").toInt(0),
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ void ui_update_theme(UIState *s) {
scene.use_stock_wheel = scene.frogpilot_toggles.value("wheel_image").toString() == "stock" && scene.frogpilot_toggles.value("current_holiday_theme").toString() == "stock";

if (!scene.use_stock_colors) {
loadThemeColors("", true);
scene.use_stock_colors |= !loadThemeColors("", true).isValid();

scene.lane_lines_color = loadThemeColors("LaneLines");
scene.lead_marker_color = loadThemeColors("LeadMarker");
Expand Down

0 comments on commit 1042a55

Please sign in to comment.