fix(channel6): ignore 'no value' signal for drive mode
This commit is contained in:
1 parent
4f17175e01
commit
14d5c605e7
2 files changed
+17
-3
No files matched your search
@@ -21,7 +21,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
serialLineRegex = regexp.MustCompile(`(?P<timestamp>\d+),(?P<channel_1>\d+),(?P<channel_2>\d+),(?P<channel_3>\d+),(?P<channel_4>\d+),(?P<channel_5>\d+),(?P<channel_6>\d+),(?P<channel_7>\d+),(?P<channel_8>\d+),(?P<frequency>\d+)`)
|
||||
serialLineRegex = regexp.MustCompile(`(?P<timestamp>\d+),(?P<channel_1>\d+),(?P<channel_2>\d+),(?P<channel_3>\d+),(?P<channel_4>\d+),(?P<channel_5>\d+),(?P<channel_6>-?\d+),(?P<channel_7>\d+),(?P<channel_8>\d+),(?P<frequency>\d+)`)
|
||||
DefaultPwmThrottle = PWMConfig{
|
||||
Min: MinPwmThrottle,
|
||||
Max: MaxPwmThrottle,
|
||||
@@ -255,6 +255,10 @@ func (a *Part) processChannel6(v string) {
|
||||
zap.S().Errorf("invalid value for channel6 'drive-mode', should be an int: %v", err)
|
||||
return
|
||||
}
|
||||
if value < 0 {
|
||||
// No value, ignore it
|
||||
return
|
||||
}
|
||||
if value > 1800 {
|
||||
if a.driveMode != events.DriveMode_PILOT {
|
||||
zap.S().Infof("Update channel 6 'drive-mode' with value %v, new user_mode: %v", value, events.DriveMode_PILOT)
|
||||
|
||||
Reference in new issue
Block a user