Refactor sensors file
Closed this issue · 1 comments
simonedegiacomi commented
The ev3_sensor.c file is very long and it contains all the logic to initialize and read raw values from sensors and to convert the raw values to the needed ones.
I think that this file needs a refactor to:
- separate the logic to convert raw values of each sensor;
- avoid the need to continuously jump between the start and the end of the file when updating/adding a new sensor;
One idea that comes to my mind is to create a ev3_sensors folder and have a file for each sensor. Then, each file would have functions with logically similar names (init_compass, init_touch, read_compass, read_touch, set_compass_mode, etc...)
simonedegiacomi commented
- move function to read sensor from ev3_sensor.c to a file for each sensor
- touch
- ev3 ir
- ht ir
- ev3 color
- ev3 ultrasonic
- ev3 gyro
- ev3 ir
- nxt temperature
- nxt sound
- ht compass
- move the sensor initialization to files for each sensor