-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSDK-730 : RDK fails to shutdown when connected to serial components #1664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great fix, I just had the one suggestion for error handling
if !isValid { | ||
|
||
fmt.Print("\n") | ||
fmt.Print("Please enter values from: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the InvalidIntegerValue
function, could we make a specific InvalidBaudRate
function in this file and have the print statements here be the message of the error returned by that function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things need to be added and tested. Run make lint test and review the style guide on the rdk readme to prepare to merge it in.
Good job.
// AttrConfig is used for converting a witmotion IMU MovementSensor config attributes. | ||
type AttrConfig struct { | ||
Port string `json:"serial_path"` | ||
BaudRate int `json:"serial_baud_rate,omitempty"` | ||
} | ||
|
||
// Validate ensures all parts of the config are valid. | ||
func (cfg *AttrConfig) Validate(path string) error { | ||
func (cfg *AttrConfig) Validate(path string, logger golog.Logger) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can;t add a logger to the Validate function. The signature now doesn't match the types we have in resource.go, remove the logger input. you're not using it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oppps, good catch, I forgot to remove it.
|
Two issues that were causing this error:
Baud rate validation is done by comparing the given baud rate from config file with the applicable baud rates found in Wit devices.
Added port closing in close function. Close will error if we loose connection to the serial port.