WMI model, fix AngleControl, CornerRadar and ETC. (#246)
This commit is contained in:
@@ -134,7 +134,7 @@ class UploadQueueCache:
|
||||
try:
|
||||
upload_queue_json = Params().get("AthenadUploadQueue")
|
||||
if upload_queue_json is not None:
|
||||
for item in json.loads(upload_queue_json):
|
||||
for item in upload_queue_json:
|
||||
upload_queue.put(UploadItem.from_dict(item))
|
||||
except Exception:
|
||||
cloudlog.exception("athena.UploadQueueCache.initialize.exception")
|
||||
@@ -144,7 +144,7 @@ class UploadQueueCache:
|
||||
try:
|
||||
queue: list[UploadItem | None] = list(upload_queue.queue)
|
||||
items = [asdict(i) for i in queue if i is not None and (i.id not in cancelled_uploads)]
|
||||
Params().put("AthenadUploadQueue", json.dumps(items))
|
||||
Params().put("AthenadUploadQueue", items)
|
||||
except Exception:
|
||||
cloudlog.exception("athena.UploadQueueCache.cache.exception")
|
||||
|
||||
@@ -453,7 +453,7 @@ def setRouteViewed(route: str) -> dict[str, int | str]:
|
||||
# maintain a list of the last 10 routes viewed in connect
|
||||
params = Params()
|
||||
|
||||
r = params.get("AthenadRecentlyViewedRoutes", encoding="utf8")
|
||||
r = params.get("AthenadRecentlyViewedRoutes")
|
||||
routes = [] if r is None else r.split(",")
|
||||
routes.append(route)
|
||||
|
||||
@@ -475,7 +475,7 @@ def startLocalProxy(global_end_event: threading.Event, remote_ws_uri: str, local
|
||||
|
||||
cloudlog.debug("athena.startLocalProxy.starting")
|
||||
|
||||
dongle_id = Params().get("DongleId").decode('utf8')
|
||||
dongle_id = Params().get("DongleId")
|
||||
identity_token = Api(dongle_id).get_token()
|
||||
ws = create_connection(remote_ws_uri,
|
||||
cookie="jwt=" + identity_token,
|
||||
@@ -516,12 +516,12 @@ def getPublicKey() -> str | None:
|
||||
|
||||
@dispatcher.add_method
|
||||
def getSshAuthorizedKeys() -> str:
|
||||
return Params().get("GithubSshKeys", encoding='utf8') or ''
|
||||
return Params().get("GithubSshKeys") or ''
|
||||
|
||||
|
||||
@dispatcher.add_method
|
||||
def getGithubUsername() -> str:
|
||||
return Params().get("GithubUsername", encoding='utf8') or ''
|
||||
return Params().get("GithubUsername") or ''
|
||||
|
||||
@dispatcher.add_method
|
||||
def getSimInfo():
|
||||
@@ -732,7 +732,7 @@ def ws_recv(ws: WebSocket, end_event: threading.Event) -> None:
|
||||
recv_queue.put_nowait(data)
|
||||
elif opcode == ABNF.OPCODE_PING:
|
||||
last_ping = int(time.monotonic() * 1e9)
|
||||
Params().put("LastAthenaPingTime", str(last_ping))
|
||||
Params().put("LastAthenaPingTime", last_ping)
|
||||
except WebSocketTimeoutException:
|
||||
ns_since_last_ping = int(time.monotonic() * 1e9) - last_ping
|
||||
if ns_since_last_ping > RECONNECT_TIMEOUT_S * 1e9:
|
||||
@@ -796,7 +796,7 @@ def main(exit_event: threading.Event = None):
|
||||
cloudlog.exception("failed to set core affinity")
|
||||
|
||||
params = Params()
|
||||
dongle_id = params.get("DongleId", encoding='utf-8')
|
||||
dongle_id = params.get("DongleId")
|
||||
UploadQueueCache.initialize(upload_queue)
|
||||
|
||||
ws_uri = ATHENA_HOST + "/ws/v2/" + dongle_id
|
||||
|
||||
@@ -14,7 +14,7 @@ ATHENA_MGR_PID_PARAM = "AthenadPid"
|
||||
|
||||
def main():
|
||||
params = Params()
|
||||
dongle_id = params.get("DongleId").decode('utf-8')
|
||||
dongle_id = params.get("DongleId")
|
||||
build_metadata = get_build_metadata()
|
||||
|
||||
cloudlog.bind_global(dongle_id=dongle_id,
|
||||
|
||||
@@ -21,7 +21,7 @@ DUMMY_IMEI2 = '865420071781904'
|
||||
|
||||
|
||||
def is_registered_device() -> bool:
|
||||
dongle = Params().get("DongleId", encoding='utf-8')
|
||||
dongle = Params().get("DongleId")
|
||||
return dongle not in (None, UNREGISTERED_DONGLE_ID)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ def register(show_spinner=False) -> str | None:
|
||||
|
||||
|
||||
#return UNREGISTERED_DONGLE_ID # for c3lite, clone
|
||||
dongle_id: str | None = params.get("DongleId", encoding='utf8')
|
||||
dongle_id: str | None = params.get("DongleId")
|
||||
if dongle_id is None and Path(Paths.persist_root()+"/comma/dongle_id").is_file():
|
||||
# not all devices will have this; added early in comma 3X production (2/28/24)
|
||||
with open(Paths.persist_root()+"/comma/dongle_id") as f:
|
||||
|
||||
@@ -380,11 +380,11 @@ class TestAthenadMethods:
|
||||
|
||||
def test_get_ssh_authorized_keys(self):
|
||||
keys = dispatcher["getSshAuthorizedKeys"]()
|
||||
assert keys == self.default_params["GithubSshKeys"].decode('utf-8')
|
||||
assert keys == self.default_params["GithubSshKeys"]
|
||||
|
||||
def test_get_github_username(self):
|
||||
keys = dispatcher["getGithubUsername"]()
|
||||
assert keys == self.default_params["GithubUsername"].decode('utf-8')
|
||||
assert keys == self.default_params["GithubUsername"]
|
||||
|
||||
def test_get_version(self):
|
||||
resp = dispatcher["getVersion"]()
|
||||
|
||||
@@ -447,7 +447,7 @@ def hardware_thread(end_event, hw_queue) -> None:
|
||||
# save last one before going onroad
|
||||
if rising_edge_started:
|
||||
try:
|
||||
params.put("LastOffroadStatusPacket", json.dumps(dat))
|
||||
params.put("LastOffroadStatusPacket", dat)
|
||||
except Exception:
|
||||
cloudlog.exception("failed to save offroad status")
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class PowerMonitoring:
|
||||
self.car_battery_capacity_uWh = max(self.car_battery_capacity_uWh, 0)
|
||||
self.car_battery_capacity_uWh = min(self.car_battery_capacity_uWh, CAR_BATTERY_CAPACITY_uWh)
|
||||
if now - self.last_save_time >= 10:
|
||||
self.params.put_nonblocking("CarBatteryCapacity", str(int(self.car_battery_capacity_uWh)))
|
||||
self.params.put_nonblocking("CarBatteryCapacity", int(self.car_battery_capacity_uWh))
|
||||
self.last_save_time = now
|
||||
|
||||
# First measurement, set integration time
|
||||
|
||||
@@ -275,6 +275,7 @@ void loggerd_thread() {
|
||||
|
||||
uint64_t msg_count = 0, bytes_count = 0;
|
||||
double start_ts = millis_since_boot();
|
||||
printf("loggerd while() started\n");
|
||||
while (!do_exit) {
|
||||
// poll for new messages on all sockets
|
||||
for (auto sock : poller->poll(1000)) {
|
||||
@@ -328,7 +329,7 @@ void loggerd_thread() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("loggerd while() exiting\n");
|
||||
LOGW("closing logger");
|
||||
s.logger.setExitSignal(do_exit.signal);
|
||||
|
||||
@@ -343,6 +344,7 @@ void loggerd_thread() {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
printf("loggerd started\n");
|
||||
if (!Hardware::PC()) {
|
||||
int ret;
|
||||
ret = util::set_core_affinity({0, 1, 2, 3});
|
||||
@@ -351,8 +353,8 @@ int main(int argc, char** argv) {
|
||||
//ret = util::set_realtime_priority(1);
|
||||
//assert(ret == 0);
|
||||
}
|
||||
|
||||
printf("loggerd runningq\n");
|
||||
loggerd_thread();
|
||||
|
||||
printf("loggerd exiting\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class Uploader:
|
||||
# self.immediate_priority.update({"rlog": 0, "rlog.zst": 0})
|
||||
|
||||
def list_upload_files(self, metered: bool) -> Iterator[tuple[str, str, str]]:
|
||||
r = self.params.get("AthenadRecentlyViewedRoutes", encoding="utf8")
|
||||
r = self.params.get("AthenadRecentlyViewedRoutes")
|
||||
requested_routes = [] if r is None else [route for route in r.split(",") if route]
|
||||
|
||||
for logdir in listdir_by_creation(self.root):
|
||||
@@ -240,7 +240,7 @@ def main(exit_event: threading.Event = None) -> None:
|
||||
clear_locks(Paths.log_root())
|
||||
|
||||
params = Params()
|
||||
dongle_id = params.get("DongleId", encoding='utf8')
|
||||
dongle_id = params.get("DongleId")
|
||||
|
||||
if dongle_id is None:
|
||||
cloudlog.info("uploader missing dongle_id")
|
||||
|
||||
+33
-199
@@ -8,7 +8,7 @@ import traceback
|
||||
from cereal import log
|
||||
import cereal.messaging as messaging
|
||||
import openpilot.system.sentry as sentry
|
||||
from openpilot.common.params import Params, ParamKeyType
|
||||
from openpilot.common.params import Params, ParamKeyFlag
|
||||
from openpilot.common.text_window import TextWindow
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
from openpilot.system.manager.helpers import unblock_stdout, write_onroad_params, save_bootlog
|
||||
@@ -19,192 +19,19 @@ from openpilot.common.swaglog import cloudlog, add_file_handler
|
||||
from openpilot.system.version import get_build_metadata, terms_version, training_version
|
||||
from openpilot.system.hardware.hw import Paths
|
||||
|
||||
def get_default_params():
|
||||
default_params : list[tuple[str, str | bytes]] = [
|
||||
# kans
|
||||
("LongPitch", "1"),
|
||||
("EVTable", "1"),
|
||||
("CompletedTrainingVersion", "0"),
|
||||
("DisengageOnAccelerator", "0"),
|
||||
("GsmMetered", "1"),
|
||||
("HasAcceptedTerms", "0"),
|
||||
("LanguageSetting", "main_en"),
|
||||
("OpenpilotEnabledToggle", "1"),
|
||||
("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)),
|
||||
("IsMetric", "1"),
|
||||
("RecordAudio", "1"),
|
||||
|
||||
("SearchInput", "0"),
|
||||
("GMapKey", "0"),
|
||||
("MapboxStyle", "0"),
|
||||
|
||||
|
||||
("LongitudinalPersonalityMax", "3"),
|
||||
("ShowDebugUI", "0"),
|
||||
("ShowTpms", "1"),
|
||||
("ShowDateTime", "1"),
|
||||
("ShowPathEnd", "1"),
|
||||
("ShowCustomBrightness", "100"),
|
||||
("ShowLaneInfo", "1"),
|
||||
("ShowRadarInfo", "1"),
|
||||
("ShowDeviceState", "1"),
|
||||
("ShowRouteInfo", "1"),
|
||||
("ShowPathMode", "9"),
|
||||
("ShowPathColor", "13"),
|
||||
("ShowPathColorCruiseOff", "19"),
|
||||
("ShowPathModeLane", "14"),
|
||||
("ShowPathColorLane", "13"),
|
||||
("ShowPlotMode", "0"),
|
||||
("AutoCruiseControl", "0"),
|
||||
("CruiseEcoControl", "2"),
|
||||
("CarrotCruiseDecel", "-1"),
|
||||
("CarrotCruiseAtcDecel", "-1"),
|
||||
("CommaLongAcc", "0"),
|
||||
("AutoGasTokSpeed", "0"),
|
||||
("AutoGasSyncSpeed", "1"),
|
||||
("AutoEngage", "0"),
|
||||
("DisableMinSteerSpeed", "0"),
|
||||
("SoftHoldMode", "0"),
|
||||
|
||||
("AutoSpeedUptoRoadSpeedLimit", "0"),
|
||||
("AutoRoadSpeedAdjust", "50"),
|
||||
("AutoCurveSpeedLowerLimit", "30"),
|
||||
("AutoCurveSpeedFactor", "120"),
|
||||
("AutoCurveSpeedAggressiveness", "100"),
|
||||
|
||||
("AutoTurnControl", "0"),
|
||||
("AutoTurnControlSpeedTurn", "20"),
|
||||
("AutoTurnControlTurnEnd", "6"),
|
||||
("AutoTurnMapChange", "0"),
|
||||
|
||||
("AutoNaviSpeedCtrlEnd", "7"),
|
||||
("AutoNaviSpeedCtrlMode", "2"),
|
||||
("AutoNaviSpeedBumpTime", "1"),
|
||||
("AutoNaviSpeedBumpSpeed", "35"),
|
||||
("AutoNaviSpeedSafetyFactor", "105"),
|
||||
("AutoNaviSpeedDecelRate", "120"),
|
||||
("AutoRoadSpeedLimitOffset", "-1"),
|
||||
("AutoNaviCountDownMode", "2"),
|
||||
("TurnSpeedControlMode", "1"),
|
||||
("CarrotSmartSpeedControl", "0"),
|
||||
("MapTurnSpeedFactor", "90"),
|
||||
("ModelTurnSpeedFactor", "0"),
|
||||
("StoppingAccel", "0"),
|
||||
("StopDistanceCarrot", "550"),
|
||||
("JLeadFactor3", "0"),
|
||||
("CruiseButtonMode", "0"),
|
||||
("CancelButtonMode", "0"),
|
||||
("LfaButtonMode", "0"),
|
||||
("CruiseButtonTest1", "8"),
|
||||
("CruiseButtonTest2", "30"),
|
||||
("CruiseButtonTest3", "1"),
|
||||
("CruiseSpeedUnit", "10"),
|
||||
("CruiseSpeedUnitBasic", "1"),
|
||||
("CruiseSpeed1", "30"),
|
||||
("CruiseSpeed2", "50"),
|
||||
("CruiseSpeed3", "80"),
|
||||
("CruiseSpeed4", "110"),
|
||||
("CruiseSpeed5", "130"),
|
||||
("PaddleMode", "0"),
|
||||
("MyDrivingMode", "3"),
|
||||
("MyDrivingModeAuto", "0"),
|
||||
("TrafficLightDetectMode", "2"),
|
||||
("CruiseMaxVals0", "160"),
|
||||
("CruiseMaxVals1", "200"),
|
||||
("CruiseMaxVals2", "160"),
|
||||
("CruiseMaxVals3", "130"),
|
||||
("CruiseMaxVals4", "110"),
|
||||
("CruiseMaxVals5", "95"),
|
||||
("CruiseMaxVals6", "80"),
|
||||
("LongTuningKpV", "100"),
|
||||
("LongTuningKiV", "0"),
|
||||
("LongTuningKf", "100"),
|
||||
("LongActuatorDelay", "20"),
|
||||
("VEgoStopping", "50"),
|
||||
("RadarReactionFactor", "100"),
|
||||
("EnableRadarTracks", "0"),
|
||||
("RadarLatFactor", "0"),
|
||||
("EnableCornerRadar", "0"),
|
||||
("HyundaiCameraSCC", "0"),
|
||||
("IsLdwsCar", "0"),
|
||||
("CanfdHDA2", "0"),
|
||||
("CanfdDebug", "0"),
|
||||
("SoundVolumeAdjust", "100"),
|
||||
("SoundVolumeAdjustEngage", "10"),
|
||||
("TFollowGap1", "110"),
|
||||
("TFollowGap2", "120"),
|
||||
("TFollowGap3", "140"),
|
||||
("TFollowGap4", "160"),
|
||||
("DynamicTFollow", "0"),
|
||||
("AChangeCostStarting", "10"),
|
||||
("TrafficStopDistanceAdjust", "400"),
|
||||
("DynamicTFollowLC", "100"),
|
||||
("HapticFeedbackWhenSpeedCamera", "0"),
|
||||
("UseLaneLineSpeed", "0"),
|
||||
("PathOffset", "0"),
|
||||
("UseLaneLineCurveSpeed", "0"),
|
||||
("AdjustLaneOffset", "0"),
|
||||
("LaneChangeNeedTorque", "0"),
|
||||
("LaneChangeDelay", "0"),
|
||||
("LaneChangeBsd", "0"),
|
||||
("MaxAngleFrames", "89"),
|
||||
("LateralTorqueCustom", "0"),
|
||||
("LateralTorqueAccelFactor", "2500"),
|
||||
("LateralTorqueFriction", "100"),
|
||||
("LateralTorqueKpV", "100"),
|
||||
("LateralTorqueKiV", "10"),
|
||||
("LateralTorqueKf", "100"),
|
||||
("LateralTorqueKd", "0"),
|
||||
("LatMpcPathCost", "200"),
|
||||
("LatMpcMotionCost", "7"),
|
||||
("LatMpcAccelCost", "120"),
|
||||
("LatMpcJerkCost", "4"),
|
||||
("LatMpcSteeringRateCost", "7"),
|
||||
("LatMpcInputOffset", "4"),
|
||||
("CustomSteerMax", "0"),
|
||||
("CustomSteerDeltaUp", "0"),
|
||||
("CustomSteerDeltaDown", "0"),
|
||||
("CustomSteerDeltaUpLC", "0"),
|
||||
("CustomSteerDeltaDownLC", "0"),
|
||||
("SpeedFromPCM", "2"),
|
||||
("SteerActuatorDelay", "0"),
|
||||
("LatSmoothSec", "13"),
|
||||
("MaxTimeOffroadMin", "60"),
|
||||
("DisableDM", "0"),
|
||||
("EnableConnect", "0"),
|
||||
("MuteDoor", "0"),
|
||||
("MuteSeatbelt", "0"),
|
||||
("RecordRoadCam", "0"),
|
||||
("HDPuse", "0"),
|
||||
("CruiseOnDist", "400"),
|
||||
("HotspotOnBoot", "0"),
|
||||
("SoftwareMenu", "1"),
|
||||
("CustomSR", "0"),
|
||||
("SteerRatioRate", "100"),
|
||||
("NNFF", "0"),
|
||||
("NNFFLite", "0"),
|
||||
("ShareData", "0"),
|
||||
]
|
||||
return default_params
|
||||
|
||||
def set_default_params():
|
||||
params = Params()
|
||||
default_params = get_default_params()
|
||||
try:
|
||||
default_params.remove(("GMapKey", "0"))
|
||||
default_params.remove(("CompletedTrainingVersion", "0"))
|
||||
default_params.remove(("LanguageSetting", "main_en"))
|
||||
default_params.remove(("GsmMetered", "1"))
|
||||
except ValueError:
|
||||
pass
|
||||
for k, v in default_params:
|
||||
params.put(k, v)
|
||||
print(f"SetToDefault[{k}]={v}")
|
||||
for k in params.all_keys():
|
||||
default_value = params.get_default_value(k)
|
||||
if default_value is not None:
|
||||
params.put(k, default_value)
|
||||
print(f"SetToDefault[{k}]={default_value}")
|
||||
|
||||
def get_default_params_key():
|
||||
default_params = get_default_params()
|
||||
all_keys = [key for key, _ in default_params]
|
||||
return all_keys
|
||||
return Params().all_keys()
|
||||
#default_params = get_default_params()
|
||||
#all_keys = [key for key, _ in default_params]
|
||||
#return all_keys
|
||||
|
||||
def manager_init() -> None:
|
||||
save_bootlog()
|
||||
@@ -212,21 +39,21 @@ def manager_init() -> None:
|
||||
build_metadata = get_build_metadata()
|
||||
|
||||
params = Params()
|
||||
params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START)
|
||||
params.clear_all(ParamKeyType.CLEAR_ON_ONROAD_TRANSITION)
|
||||
params.clear_all(ParamKeyType.CLEAR_ON_OFFROAD_TRANSITION)
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_MANAGER_START)
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_ONROAD_TRANSITION)
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_OFFROAD_TRANSITION)
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_IGNITION_ON)
|
||||
if build_metadata.release_channel:
|
||||
params.clear_all(ParamKeyType.DEVELOPMENT_ONLY)
|
||||
|
||||
default_params = get_default_params()
|
||||
params.clear_all(ParamKeyFlag.DEVELOPMENT_ONLY)
|
||||
|
||||
if params.get_bool("RecordFrontLock"):
|
||||
params.put_bool("RecordFront", True)
|
||||
|
||||
# set unset params
|
||||
for k, v in default_params:
|
||||
if params.get(k) is None:
|
||||
params.put(k, v)
|
||||
# set unset params to their default value
|
||||
for k in params.all_keys():
|
||||
default_value = params.get_default_value(k)
|
||||
if default_value is not None and params.get(k) is None:
|
||||
params.put(k, default_value)
|
||||
|
||||
# Create folders needed for msgq
|
||||
try:
|
||||
@@ -298,25 +125,27 @@ def manager_thread() -> None:
|
||||
params = Params()
|
||||
|
||||
ignore: list[str] = []
|
||||
if params.get("DongleId", encoding='utf8') in (None, UNREGISTERED_DONGLE_ID):
|
||||
if params.get("DongleId") in (None, UNREGISTERED_DONGLE_ID):
|
||||
ignore += ["manage_athenad", "uploader"]
|
||||
if os.getenv("NOBOARD") is not None:
|
||||
ignore.append("pandad")
|
||||
ignore += [x for x in os.getenv("BLOCK", "").split(",") if len(x) > 0]
|
||||
|
||||
if params.get("HardwareC3xLite"):
|
||||
if params.get_bool("HardwareC3xLite"):
|
||||
ignore += ["micd", "soundd", "loggerd"]
|
||||
params.put("RecordAudio", "0")
|
||||
params.put_bool("RecordAudio", False)
|
||||
|
||||
sm = messaging.SubMaster(['deviceState', 'carParams'], poll='deviceState')
|
||||
sm = messaging.SubMaster(['deviceState', 'carParams', 'pandaStates'], poll='deviceState')
|
||||
pm = messaging.PubMaster(['managerState'])
|
||||
|
||||
write_onroad_params(False, params)
|
||||
print(f"################# ignore process list: {ignore} #################")
|
||||
ensure_running(managed_processes.values(), False, params=params, CP=sm['carParams'], not_run=ignore)
|
||||
|
||||
print_timer = 0
|
||||
|
||||
started_prev = False
|
||||
ignition_prev = False
|
||||
|
||||
while True:
|
||||
sm.update(1000)
|
||||
@@ -324,15 +153,20 @@ def manager_thread() -> None:
|
||||
started = sm['deviceState'].started
|
||||
|
||||
if started and not started_prev:
|
||||
params.clear_all(ParamKeyType.CLEAR_ON_ONROAD_TRANSITION)
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_ONROAD_TRANSITION)
|
||||
elif not started and started_prev:
|
||||
params.clear_all(ParamKeyType.CLEAR_ON_OFFROAD_TRANSITION)
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_OFFROAD_TRANSITION)
|
||||
|
||||
ignition = any(ps.ignitionLine or ps.ignitionCan for ps in sm['pandaStates'] if ps.pandaType != log.PandaState.PandaType.unknown)
|
||||
if ignition and not ignition_prev:
|
||||
params.clear_all(ParamKeyFlag.CLEAR_ON_IGNITION_ON)
|
||||
|
||||
# update onroad params, which drives pandad's safety setter thread
|
||||
if started != started_prev:
|
||||
write_onroad_params(started, params)
|
||||
|
||||
started_prev = started
|
||||
ignition_prev = ignition
|
||||
|
||||
ensure_running(managed_processes.values(), started, params=params, CP=sm['carParams'], not_run=ignore)
|
||||
|
||||
|
||||
@@ -197,7 +197,6 @@ class NativeProcess(ManagerProcess):
|
||||
self.watchdog_seen = False
|
||||
self.shutting_down = False
|
||||
|
||||
|
||||
class PythonProcess(ManagerProcess):
|
||||
def __init__(self, name, module, should_run, enabled=True, sigkill=False, watchdog_max_dt=None):
|
||||
self.name = name
|
||||
@@ -256,7 +255,7 @@ class DaemonProcess(ManagerProcess):
|
||||
if self.params is None:
|
||||
self.params = Params()
|
||||
|
||||
pid = self.params.get(self.param_name, encoding='utf-8')
|
||||
pid = self.params.get(self.param_name)
|
||||
if pid is not None:
|
||||
try:
|
||||
os.kill(int(pid), 0)
|
||||
@@ -275,7 +274,7 @@ class DaemonProcess(ManagerProcess):
|
||||
stderr=open('/dev/null', 'w'),
|
||||
preexec_fn=os.setpgrp)
|
||||
|
||||
self.params.put(self.param_name, str(proc.pid))
|
||||
self.params.put(self.param_name, proc.pid)
|
||||
|
||||
def stop(self, retry=True, block=True, sig=None) -> None:
|
||||
pass
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ def init(project: SentryProject) -> bool:
|
||||
return False
|
||||
|
||||
env = "release" if build_metadata.tested_channel else "master"
|
||||
dongle_id = Params().get("DongleId", encoding='utf-8')
|
||||
dongle_id = Params().get("DongleId")
|
||||
|
||||
integrations = []
|
||||
if project == SentryProject.SELFDRIVE:
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class StatLog:
|
||||
|
||||
|
||||
def main() -> NoReturn:
|
||||
dongle_id = Params().get("DongleId", encoding='utf-8')
|
||||
dongle_id = Params().get("DongleId")
|
||||
def get_influxdb_line(measurement: str, value: float | dict[str, float], timestamp: datetime, tags: dict) -> str:
|
||||
res = f"{measurement}"
|
||||
for k, v in tags.items():
|
||||
|
||||
@@ -132,8 +132,8 @@ class TestBaseUpdate:
|
||||
|
||||
class ParamsBaseUpdateTest(TestBaseUpdate):
|
||||
def _test_finalized_update(self, branch, version, agnos_version, release_notes):
|
||||
assert self.params.get("UpdaterNewDescription", encoding="utf-8").startswith(f"{version} / {branch}")
|
||||
assert self.params.get("UpdaterNewReleaseNotes", encoding="utf-8") == f"{release_notes}\n"
|
||||
assert self.params.get("UpdaterNewDescription").startswith(f"{version} / {branch}")
|
||||
assert self.params.get("UpdaterNewReleaseNotes") == f"{release_notes}\n"
|
||||
super()._test_finalized_update(branch, version, agnos_version, release_notes)
|
||||
|
||||
def send_check_for_updates_signal(self, updated: ManagerProcess):
|
||||
@@ -143,7 +143,7 @@ class ParamsBaseUpdateTest(TestBaseUpdate):
|
||||
updated.signal(signal.SIGHUP.value)
|
||||
|
||||
def _test_params(self, branch, fetch_available, update_available):
|
||||
assert self.params.get("UpdaterTargetBranch", encoding="utf-8") == branch
|
||||
assert self.params.get("UpdaterTargetBranch") == branch
|
||||
assert self.params.get_bool("UpdaterFetchAvailable") == fetch_available
|
||||
assert self.params.get_bool("UpdateAvailable") == update_available
|
||||
|
||||
@@ -151,8 +151,8 @@ class ParamsBaseUpdateTest(TestBaseUpdate):
|
||||
self.wait_for_condition(lambda: self.params.get("UpdaterState", encoding="utf-8") == "idle")
|
||||
|
||||
def wait_for_failed(self):
|
||||
self.wait_for_condition(lambda: self.params.get("UpdateFailedCount", encoding="utf-8") is not None and \
|
||||
int(self.params.get("UpdateFailedCount", encoding="utf-8")) > 0)
|
||||
self.wait_for_condition(lambda: self.params.get("UpdateFailedCount") is not None and \
|
||||
int(self.params.get("UpdateFailedCount")) > 0)
|
||||
|
||||
def wait_for_fetch_available(self):
|
||||
self.wait_for_condition(lambda: self.params.get_bool("UpdaterFetchAvailable"))
|
||||
|
||||
@@ -61,10 +61,10 @@ class WaitTimeHelper:
|
||||
|
||||
def write_time_to_param(params, param) -> None:
|
||||
t = datetime.datetime.now(datetime.UTC).replace(tzinfo=None)
|
||||
params.put(param, t.isoformat().encode('utf8'))
|
||||
params.put(param, t)
|
||||
|
||||
def read_time_from_param(params, param) -> datetime.datetime | None:
|
||||
t = params.get(param, encoding='utf8')
|
||||
t = params.get(param)
|
||||
try:
|
||||
return datetime.datetime.fromisoformat(t)
|
||||
except (TypeError, ValueError):
|
||||
@@ -242,7 +242,7 @@ class Updater:
|
||||
|
||||
@property
|
||||
def target_branch(self) -> str:
|
||||
b: str | None = self.params.get("UpdaterTargetBranch", encoding='utf-8')
|
||||
b: str | None = self.params.get("UpdaterTargetBranch")
|
||||
if b is None:
|
||||
b = self.get_branch(BASEDIR)
|
||||
return b
|
||||
@@ -272,7 +272,7 @@ class Updater:
|
||||
return run(["git", "rev-parse", "HEAD"], path).rstrip()
|
||||
|
||||
def set_params(self, update_success: bool, failed_count: int, exception: str | None) -> None:
|
||||
self.params.put("UpdateFailedCount", str(failed_count))
|
||||
self.params.put("UpdateFailedCount", failed_count)
|
||||
self.params.put("UpdaterTargetBranch", self.target_branch)
|
||||
|
||||
self.params.put_bool("UpdaterFetchAvailable", self.update_available)
|
||||
@@ -429,8 +429,8 @@ def main() -> None:
|
||||
cloudlog.event("update installed")
|
||||
|
||||
if not params.get("InstallDate"):
|
||||
t = datetime.datetime.now(datetime.UTC).replace(tzinfo=None).isoformat()
|
||||
params.put("InstallDate", t.encode('utf8'))
|
||||
t = datetime.datetime.now(datetime.UTC).replace(tzinfo=None)
|
||||
params.put("InstallDate", t)
|
||||
|
||||
updater = Updater()
|
||||
update_failed_count = 0 # TODO: Load from param?
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging', 'nightly-dev']
|
||||
|
||||
BUILD_METADATA_FILENAME = "build.json"
|
||||
|
||||
training_version: bytes = b"0.2.0"
|
||||
terms_version: bytes = b"2"
|
||||
training_version: str = "0.2.0"
|
||||
terms_version: str = "2"
|
||||
|
||||
|
||||
def get_version(path: str = BASEDIR) -> str:
|
||||
|
||||
Reference in New Issue
Block a user