ProjectNeura / LEADS

Enable your racing car with powerful, data-driven instrumentation, control, and analysis systems, all wrapped up in a gorgeous look.
https://leads.projectneura.org
Apache License 2.0
257 stars 54 forks source link

The Main Controller does not Reset as Expected #357

Closed ATATC closed 3 months ago

ATATC commented 3 months ago

In the default devices module in LEADS VeC, the main controller is denied as such.

@controller(MAIN_CONTROLLER)
class VeCController(Controller):
    @override
    def initialize(self, *parent_tags: str) -> None:
        super().initialize(*parent_tags)
        mark_device(self, "")
        if not has_controller("pc"):
            mark_device(self, "POWER", "BATT", "MOTOR", "BRAKE")
        if not has_controller("wsc"):
            mark_device(self, "WSC", "ESC")
        if not has_device(ODOMETER):
            mark_device(self, "WSC")
        if not has_device(GPS_RECEIVER):
            mark_device(self, "GPS")
        if not has_device(BRAKE_INDICATOR):
            mark_device(self, "LIGHT")
        if not has_device(LEFT_INDICATOR):
            mark_device(self, "LIGHT")
        if not has_device(RIGHT_INDICATOR):
            mark_device(self, "LIGHT")
        if read_device_marker(self):
            SFT.fail(self, RuntimeError("Unexpected system integrity"))

mark_device(self, "") intends to reset the device marker but instead of overwriting the marker, it appends an empty system.