SRA-VJTI / sra-board-component

ESP-IDF component for SRA Board
https://sravjti.in/sra-board-component/
MIT License
36 stars 20 forks source link

Error Handling Blocks #9

Closed laukik-hase closed 4 years ago

laukik-hase commented 4 years ago

https://github.com/SRA-VJTI/sra-board-component/blob/6fc123672daa01aa050f5e3db8d87741e3b18f51/src/servo.c#L9

Remove error handling blocks for functions which have a very little chance of failing. (These functions will be automatically get verified when stress-tested)

VedantParanjape commented 4 years ago

Fixed in 80c40452484da403d5dfedbdc64ec38520d78551

VedantParanjape commented 4 years ago

@laukik-hase Please code review again, I also added bound checks to degree_of_rotation parameter, such that if it is greater than SERVO_MAX_DEGREE it will become equal to SERVO_MAX_DEGREE.

Changed it in 13b55a9f82cb383f876105d6460bd3d3943e7d73

laukik-hase commented 4 years ago

@VedantParanjape Use either operation success or failure in error checking. Both of them make code redundant

laukik-hase commented 4 years ago

@VedantParanjape https://github.com/SRA-VJTI/sra-board-component/blob/13b55a9f82cb383f876105d6460bd3d3943e7d73/src/servo.c#L52 Very dangerous naming followed here.

Also, the second part in the if check is redundant. Get it?

VedantParanjape commented 4 years ago

@VedantParanjape https://github.com/SRA-VJTI/sra-board-component/blob/13b55a9f82cb383f876105d6460bd3d3943e7d73/src/servo.c#L52 Very dangerous naming followed here.

Also, the second part in the if check is redundant. Get it?

Yes, got it. I will make the change, maybe make the err__A into err_D, alright?

VedantParanjape commented 4 years ago

@laukik-hase Fixed in 2619bc76c739efd06095768b163231ee789b70e3

laukik-hase commented 4 years ago

Done.