Reverse switchRecord flag

When rc is down, record mode must be false
This commit is contained in:
Cyrille Nofficial 2020-02-03 19:41:29 +01:00
parent 2968428443
commit 61dffd0a00
2 changed files with 4 additions and 4 deletions

View File

@ -246,7 +246,7 @@ func (a *Part) publishDriveMode() {
func (a *Part) publishSwitchRecord() { func (a *Part) publishSwitchRecord() {
sr := events.SwitchRecordMessage{ sr := events.SwitchRecordMessage{
Enabled: a.ctrlRecord, Enabled: !a.ctrlRecord,
} }
switchRecordMessage, err := proto.Marshal(&sr) switchRecordMessage, err := proto.Marshal(&sr)
if err != nil { if err != nil {

View File

@ -214,19 +214,19 @@ func TestPublish(t *testing.T) {
expectedDriveMode events.DriveModeMessage expectedDriveMode events.DriveModeMessage
expectedSwitchRecord events.SwitchRecordMessage expectedSwitchRecord events.SwitchRecordMessage
}{ }{
{-1, 1, events.DriveMode_USER, false, {-1, 1, events.DriveMode_USER, true,
events.ThrottleMessage{Throttle: -1., Confidence: 1.}, events.ThrottleMessage{Throttle: -1., Confidence: 1.},
events.SteeringMessage{Steering: 1.0, Confidence: 1.}, events.SteeringMessage{Steering: 1.0, Confidence: 1.},
events.DriveModeMessage{DriveMode: events.DriveMode_USER}, events.DriveModeMessage{DriveMode: events.DriveMode_USER},
events.SwitchRecordMessage{Enabled: false}, events.SwitchRecordMessage{Enabled: false},
}, },
{0, 0, events.DriveMode_PILOT, true, {0, 0, events.DriveMode_PILOT, false,
events.ThrottleMessage{Throttle: 0., Confidence: 1.}, events.ThrottleMessage{Throttle: 0., Confidence: 1.},
events.SteeringMessage{Steering: 0., Confidence: 1.}, events.SteeringMessage{Steering: 0., Confidence: 1.},
events.DriveModeMessage{DriveMode: events.DriveMode_PILOT}, events.DriveModeMessage{DriveMode: events.DriveMode_PILOT},
events.SwitchRecordMessage{Enabled: true}, events.SwitchRecordMessage{Enabled: true},
}, },
{0.87, -0.58, events.DriveMode_PILOT, true, {0.87, -0.58, events.DriveMode_PILOT, false,
events.ThrottleMessage{Throttle: 0.87, Confidence: 1.}, events.ThrottleMessage{Throttle: 0.87, Confidence: 1.},
events.SteeringMessage{Steering: -0.58, Confidence: 1.}, events.SteeringMessage{Steering: -0.58, Confidence: 1.},
events.DriveModeMessage{DriveMode: events.DriveMode_PILOT}, events.DriveModeMessage{DriveMode: events.DriveMode_PILOT},