From 0102a1c704dcf3b5dc00e98fa1390a993507acb2 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 22 Apr 2025 00:03:06 -0400 Subject: [PATCH 1/2] DM: Use `carControl.latActive` for MADS DM monitoring (#845) --- selfdrive/monitoring/dmonitoringd.py | 2 +- selfdrive/monitoring/helpers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/monitoring/dmonitoringd.py b/selfdrive/monitoring/dmonitoringd.py index d0d28ebac..71733f99f 100755 --- a/selfdrive/monitoring/dmonitoringd.py +++ b/selfdrive/monitoring/dmonitoringd.py @@ -11,7 +11,7 @@ def dmonitoringd_thread(): params = Params() pm = messaging.PubMaster(['driverMonitoringState']) sm = messaging.SubMaster(['driverStateV2', 'liveCalibration', 'carState', 'selfdriveState', 'modelV2', - 'selfdriveStateSP'], poll='driverStateV2') + 'carControl'], poll='driverStateV2') DM = DriverMonitoring(rhd_saved=params.get_bool("IsRhdDetected"), always_on=params.get_bool("AlwaysOnDM")) diff --git a/selfdrive/monitoring/helpers.py b/selfdrive/monitoring/helpers.py index 0ff7a52a9..67776994f 100644 --- a/selfdrive/monitoring/helpers.py +++ b/selfdrive/monitoring/helpers.py @@ -403,13 +403,13 @@ class DriverMonitoring: driver_state=sm['driverStateV2'], cal_rpy=sm['liveCalibration'].rpyCalib, car_speed=sm['carState'].vEgo, - op_engaged=sm['selfdriveState'].enabled or sm['selfdriveStateSP'].mads.active + op_engaged=sm['selfdriveState'].enabled or sm['carControl'].latActive ) # Update distraction events self._update_events( driver_engaged=sm['carState'].steeringPressed or sm['carState'].gasPressed, - op_engaged=sm['selfdriveState'].enabled or sm['selfdriveStateSP'].mads.active, + op_engaged=sm['selfdriveState'].enabled or sm['carControl'].latActive, standstill=sm['carState'].standstill, wrong_gear=sm['carState'].gearShifter in [car.CarState.GearShifter.reverse, car.CarState.GearShifter.park], car_speed=sm['carState'].vEgo From fd0d4a5aab7d3c34fb649f5ca330a5871390168d Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Tue, 22 Apr 2025 14:54:18 +0200 Subject: [PATCH 2/2] ci: fixes for trigger conditions on sync (#847) pull_request_target is needed for security, but at the same time it makes life a little harder because the ref is different so we need to do some work to make sure we get what we are supposed to get --- .../workflows/sunnypilot-build-prebuilt.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sunnypilot-build-prebuilt.yaml b/.github/workflows/sunnypilot-build-prebuilt.yaml index 156e10515..c203edfa7 100644 --- a/.github/workflows/sunnypilot-build-prebuilt.yaml +++ b/.github/workflows/sunnypilot-build-prebuilt.yaml @@ -54,11 +54,13 @@ jobs: version: ${{ steps.set-env.outputs.version }} extra_version_identifier: ${{ steps.set-env.outputs.extra_version_identifier }} commit_sha: ${{ steps.set-env.outputs.commit_sha }} - if: always() && !failure() && !cancelled() + if: ${{ (always() && !failure() && !cancelled()) && (!contains(github.event_name, 'pull_request') || (github.event.action == 'labeled' && github.event.label.name == 'prebuilt')) }} steps: - uses: actions/checkout@v4 with: submodules: recursive + ref: ${{ github.head_ref || github.ref_name }} + repository: ${{ github.event.pull_request.head.repo.fork && github.event.pull_request.head.repo.full_name || github.repository }} - run: git lfs pull - name: Cache SCons @@ -75,15 +77,16 @@ jobs: scons-${{ runner.os }}-${{ runner.arch }} - name: Set Configuration + if: (!github.event.pull_request.head.repo.fork) run: | - if [[ "${{ github.ref_name }}" == "${{ env.DEV_C3_SOURCE_BRANCH }}" ]]; then + if [[ "${{ github.head_ref || github.ref_name }}" == "${{ env.DEV_C3_SOURCE_BRANCH }}" ]]; then # Dev configuration echo "BRANCH_TYPE=dev" >> $GITHUB_ENV echo "NEW_BRANCH=${{ env.DEV_TARGET_BRANCH }}" >> $GITHUB_ENV echo "VERSION=$(date '+%Y.%m.%d')-${{ github.run_number }}" >> $GITHUB_ENV echo "EXTRA_VERSION_IDENTIFIER=${{ github.run_number }}" >> $GITHUB_ENV - elif [[ "${{ github.ref_name }}" == "${{ env.MASTER_BRANCH }}" || "${{ github.ref_name }}" == "${{ env.MASTER_NEW_BRANCH }}" ]]; then + elif [[ "${{ github.head_ref || github.ref_name }}" == "${{ env.MASTER_BRANCH }}" || "${{ github.ref_name }}" == "${{ env.MASTER_NEW_BRANCH }}" ]]; then # Master configuration echo "BRANCH_TYPE=master" >> $GITHUB_ENV echo "NEW_BRANCH=${{ env.STAGING_TARGET_BRANCH }}" >> $GITHUB_ENV @@ -103,6 +106,13 @@ jobs: echo "NEW_BRANCH=${{ github.head_ref || github.ref_name }}-prebuilt" >> $GITHUB_ENV echo "VERSION=$(date '+%Y.%m.%d')-${{ github.run_number }}" >> $GITHUB_ENV fi + + - name: Set Configuration (only forks) + if: (github.event.pull_request.head.repo.fork) + run: | + echo "BRANCH_TYPE=dispatch" >> $GITHUB_ENV + echo "NEW_BRANCH=${{ github.head_ref || github.ref_name }}-fork-prebuilt" >> $GITHUB_ENV + echo "VERSION=$(date '+%Y.%m.%d')-${{ github.run_number }}" >> $GITHUB_ENV - name: Set environment variables id: set-env @@ -258,7 +268,7 @@ jobs: notify: needs: [ build, publish ] runs-on: ubuntu-24.04 - if: ${{ (always() && !failure() && !cancelled()) }} + if: ${{ (always() && !failure() && !cancelled()) && (!contains(github.event_name, 'pull_request') || (github.event.action == 'labeled' && github.event.label.name == 'prebuilt')) }} steps: - uses: actions/checkout@v4 - name: Setup Alpine Linux environment