mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-17 06:13:52 +08:00
Reapply "offset cluster"
This commit is contained in:
Binary file not shown.
@@ -263,6 +263,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"EVTuning", {PERSISTENT, BOOL, "0", "0", 3}},
|
||||
{"Fahrenheit", {PERSISTENT, BOOL, "0", "0", 3}},
|
||||
{"FlashPanda", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}},
|
||||
{"GMDashSpoofOffsets", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"GMPedalLongitudinal", {PERSISTENT, BOOL, "1", "1", 2}},
|
||||
{"LongPitch", {PERSISTENT, BOOL, "1", "0", 2}},
|
||||
{"RemoteStartBootsComma", {PERSISTENT, BOOL, "0", "0"}},
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
extern const uint8_t gitversion[19];
|
||||
const uint8_t gitversion[19] = "DEV-8c00f0a3-DEBUG";
|
||||
const uint8_t gitversion[19] = "DEV-78c30377-DEBUG";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
DEV-8c00f0a3-DEBUG
|
||||
DEV-78c30377-DEBUG
|
||||
@@ -35,6 +35,26 @@ LaneChangeDirection = log.LaneChangeDirection
|
||||
ACTUATOR_FIELDS = tuple(car.CarControl.Actuators.schema.fields.keys())
|
||||
|
||||
|
||||
def get_gm_hud_set_speed(set_speed_ms: float, controls_enabled: bool, starpilot_toggles, starpilot_plan) -> float:
|
||||
spoofed_speed = set_speed_ms
|
||||
|
||||
set_speed_offset = float(getattr(starpilot_toggles, "set_speed_offset", 0.0) or 0.0)
|
||||
if spoofed_speed > 0 and set_speed_offset > 0:
|
||||
spoofed_speed += set_speed_offset * CV.KPH_TO_MS
|
||||
|
||||
if not controls_enabled or not getattr(starpilot_toggles, "speed_limit_controller", False):
|
||||
return spoofed_speed
|
||||
|
||||
slc_source = str(getattr(starpilot_plan, "slcSpeedLimitSource", "") or "")
|
||||
slc_speed_limit = float(getattr(starpilot_plan, "slcSpeedLimit", 0.0) or 0.0)
|
||||
slc_speed_limit_offset = float(getattr(starpilot_plan, "slcSpeedLimitOffset", 0.0) or 0.0)
|
||||
|
||||
if slc_source != "None" and slc_speed_limit > 0:
|
||||
return slc_speed_limit + slc_speed_limit_offset
|
||||
|
||||
return spoofed_speed
|
||||
|
||||
|
||||
class Controls:
|
||||
def __init__(self) -> None:
|
||||
self.params = Params()
|
||||
@@ -192,7 +212,18 @@ class Controls:
|
||||
CC.cruiseControl.resume = CC.enabled and CS.cruiseState.standstill and not self.sm['longitudinalPlan'].shouldStop
|
||||
|
||||
hudControl = CC.hudControl
|
||||
hudControl.setSpeed = float(CS.vCruiseCluster * CV.KPH_TO_MS)
|
||||
hud_set_speed = float(CS.vCruiseCluster * CV.KPH_TO_MS)
|
||||
gm_dash_spoof_offsets_enabled = (
|
||||
self.CP.brand == "gm" and
|
||||
self.CP.openpilotLongitudinalControl and
|
||||
self.CP.enableGasInterceptorDEPRECATED and
|
||||
getattr(self.starpilot_toggles, "gm_pedal_longitudinal", True) and
|
||||
not getattr(self.starpilot_toggles, "disable_openpilot_long", False) and
|
||||
getattr(self.starpilot_toggles, "gm_dash_spoof_offsets", False)
|
||||
)
|
||||
if gm_dash_spoof_offsets_enabled:
|
||||
hud_set_speed = get_gm_hud_set_speed(hud_set_speed, CC.enabled, self.starpilot_toggles, self.sm['starpilotPlan'])
|
||||
hudControl.setSpeed = hud_set_speed
|
||||
hudControl.speedVisible = CC.enabled
|
||||
hudControl.lanesVisible = CC.enabled
|
||||
hudControl.leadVisible = self.sm['longitudinalPlan'].hasLead
|
||||
|
||||
Binary file not shown.
@@ -248,6 +248,14 @@ class StarPilotGMVehicleLayout(StarPilotPanel):
|
||||
"color": "#64748B",
|
||||
"key": "GMPedalLongitudinal",
|
||||
},
|
||||
{
|
||||
"title": tr_noop("Offsets on Dash Spoof"),
|
||||
"type": "toggle",
|
||||
"get_state": lambda: self._params.get_bool("GMDashSpoofOffsets"),
|
||||
"set_state": lambda s: self._params.put_bool("GMDashSpoofOffsets", s),
|
||||
"color": "#64748B",
|
||||
"key": "GMDashSpoofOffsets",
|
||||
},
|
||||
{
|
||||
"title": tr_noop("Smooth Pedal on Hills"),
|
||||
"type": "toggle",
|
||||
@@ -288,6 +296,8 @@ class StarPilotGMVehicleLayout(StarPilotPanel):
|
||||
|
||||
if key == "GMPedalLongitudinal":
|
||||
visible = cs.hasPedal or cs.canUsePedal
|
||||
elif key == "GMDashSpoofOffsets":
|
||||
visible = cs.hasPedal or cs.canUsePedal
|
||||
elif key == "VoltSNG":
|
||||
visible = cs.isVolt and not cs.hasSNG
|
||||
|
||||
|
||||
Binary file not shown.
@@ -170,6 +170,7 @@ SAFE_MODE_MANAGED_KEYS = (
|
||||
"SubaruSNG",
|
||||
"VoltSNG",
|
||||
"GMPedalLongitudinal",
|
||||
"GMDashSpoofOffsets",
|
||||
"LongPitch",
|
||||
"TacoTuneHacks",
|
||||
)
|
||||
|
||||
@@ -1074,6 +1074,10 @@ class StarPilotVariables:
|
||||
"GMPedalLongitudinal",
|
||||
condition=toggle.car_make == "gm" and toggle.has_pedal,
|
||||
)
|
||||
toggle.gm_dash_spoof_offsets = self.get_value(
|
||||
"GMDashSpoofOffsets",
|
||||
condition=toggle.car_make == "gm" and toggle.has_pedal,
|
||||
)
|
||||
toggle.long_pitch = self.get_value(
|
||||
"LongPitch",
|
||||
condition=toggle.openpilot_longitudinal and toggle.car_make == "gm",
|
||||
|
||||
@@ -2016,6 +2016,13 @@
|
||||
"data_type": "bool",
|
||||
"ui_type": "toggle"
|
||||
},
|
||||
{
|
||||
"key": "GMDashSpoofOffsets",
|
||||
"label": "Apply Offsets To Dash Spoof",
|
||||
"description": "On GM pedal-long cars, add the active global set-speed offset or SLC offset to the spoofed dash set speed.",
|
||||
"data_type": "bool",
|
||||
"ui_type": "toggle"
|
||||
},
|
||||
{
|
||||
"key": "LongPitch",
|
||||
"label": "Smooth Pedal Response on Hills",
|
||||
|
||||
@@ -175,6 +175,7 @@ StarPilotVehiclesPanel::StarPilotVehiclesPanel(StarPilotSettingsWindow *parent,
|
||||
std::vector<std::tuple<QString, QString, QString, QString>> vehicleToggles {
|
||||
{"GMToggles", tr("General Motors Settings"), tr("<b>StarPilot features for General Motors vehicles.</b>"), ""},
|
||||
{"GMPedalLongitudinal", tr("Use Pedal For Longitudinal"), tr("<b>Use the pedal interceptor for full longitudinal control</b> on supported GM vehicles."), ""},
|
||||
{"GMDashSpoofOffsets", tr("Apply Offsets To Dash Spoof"), tr("<b>On GM pedal-long cars, add the active global set-speed offset or SLC offset</b> to the spoofed dash set speed."), ""},
|
||||
{"LongPitch", tr("Smooth Pedal Response on Hills"), tr("<b>Smoothen acceleration and braking</b> when driving downhill/uphill."), ""},
|
||||
{"RemoteStartBootsComma", tr("Remote Start Boots comma"), tr("<b>Use the remote-start GM panda firmware at boot.</b><br><br>Required for GM remote-start startup signal behavior."), ""},
|
||||
{"RemapCancelToDistance", tr("Remap Cancel To Distance"), tr("<b>On pedal-interceptor Bolts, remap the steering-wheel CANCEL button to distance/personality input.</b>"), ""},
|
||||
@@ -434,6 +435,10 @@ void StarPilotVehiclesPanel::updateToggles() {
|
||||
setVisible &= parent->hasPedal || (Hardware::PC() && parent->canUsePedal);
|
||||
}
|
||||
|
||||
else if (key == "GMDashSpoofOffsets") {
|
||||
setVisible &= parent->hasPedal || (Hardware::PC() && parent->canUsePedal);
|
||||
}
|
||||
|
||||
else if (key == "RemapCancelToDistance") {
|
||||
setVisible &= parent->isBolt && (parent->hasPedal || (Hardware::PC() && parent->canUsePedal));
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ private:
|
||||
|
||||
std::map<QString, AbstractControl*> toggles;
|
||||
|
||||
QSet<QString> gmKeys = {"GMPedalLongitudinal", "LongPitch", "RemoteStartBootsComma", "RemapCancelToDistance", "VoltSNG"};
|
||||
QSet<QString> gmKeys = {"GMPedalLongitudinal", "GMDashSpoofOffsets", "LongPitch", "RemoteStartBootsComma", "RemapCancelToDistance", "VoltSNG"};
|
||||
QSet<QString> hkgKeys = {"TacoTuneHacks"};
|
||||
QSet<QString> longitudinalKeys = {"FrogsGoMoosTweak", "LongPitch", "RemapCancelToDistance", "SNGHack", "VoltSNG"};
|
||||
QSet<QString> longitudinalKeys = {"FrogsGoMoosTweak", "GMDashSpoofOffsets", "LongPitch", "RemapCancelToDistance", "SNGHack", "VoltSNG"};
|
||||
QSet<QString> subaruKeys = {"SubaruSNG"};
|
||||
QSet<QString> toyotaKeys = {"ClusterOffset", "FrogsGoMoosTweak", "LockDoorsTimer", "SNGHack", "ToyotaDoors"};
|
||||
QSet<QString> vehicleInfoKeys = {"BlindSpotSupport", "HardwareDetected", "OpenpilotLongitudinal", "PedalSupport", "RadarSupport", "SDSUSupport", "SNGSupport"};
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user