-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚸 Improve error Handling in VDML (#125)
Summary - Changed port number validation to return ENXIO when outside the domain of port numbers - Changed port validation to return ENODEV when the requested device doesn't match the actual device - Vision Sensor read/get functions consistently use EAGAIN when the libv5rts tells us it couldn't get data - Remove docstrings for EACCES since it is practically impossible to get that errno (we wait for mutex indefinitely) - vision_get_by_sig consistently sets errno to EDOM when unable to find objects that match (valid) arguments Right now, our returned errnos aren't that great. Close #117 - [X] When objects are in vision sensors FOV, but none are of a particular signature, signature ID is correct and EDOM is errno ```cpp errno = 0; // set to 0 to make sure errno is being set properly... normally wouldn't do this // errno was 33 b/c there were no objects to see of signature 1 pros::lcd::print(1, "%d (%d)", vision.get_by_sig(0, 1).signature, errno); errno = 0; // errno was 0 b/c it worked fine pros::lcd::print(2, "%d (%d)", vision.get_by_sig(0, 2).signature, errno); errno = 0; // errno was flickered between 0/33 b/c there were sometimes objects of 2 to see pros::lcd::print(3, "%d (%d)", vision.get_by_sig(2, 2).signature, errno); errno = 0; // errno was EINVAL (22) because 8 is an invalid signature id pros::lcd::print(4, "%d (%d)", vision.get_by_sig(8, 2).signature, errno); errno = 0; // errno was EADDRINUSE (112) b/c there was a radio plugged in pros::lcd::print(5, "%d (%d)", pros::c::vision_get_by_sig(21, 0, 1).signature, errno); errno = 0; // errno was ENXIO (6) b/c there's no smart port #22 pros::lcd::print(6, "%d (%d)", pros::c::vision_get_by_sig(22, 0, 1).signature, errno); // errno was ENODEV (19) b/c there's no motor plugged into 2 (or anything for that matter) errno = 0; pros::lcd::print(7, "%d (%d)", pros::c::motor_get_voltage(2), errno); ```
- Loading branch information
Showing
17 changed files
with
1,429 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.