USSTRocketry / MiniRockets

Making rockets that hopefully go UP!
MIT License
2 stars 11 forks source link

Standardise ambiguous booleans and ints #32

Closed frroossst closed 1 year ago

frroossst commented 1 year ago

At some places in the codebase bools and ints are used interchangeably, standardise and fix this

MostlyGenius commented 1 year ago

can you assign this issue to me? @frroossst

MostlyGenius commented 1 year ago

Hi, Had a bit of the covid but now fine. Can you point out where bools and ints are used interchangeably? I realize I can just use a script to crawl the script, but hoping to get an example first. thanks

frroossst commented 1 year ago

Hey, no worries!

src/sensor_MS5611.cpp: init_MS5611() returns a bool, so does init_kx134 in src/sensor_kx134.cpp

I'd prefer if they all returned exit codes instead like EXIT_SUCCESS, EXIT_FAILURE and no other, yes they are technically just booleans but this makes the code a bit more readable.

ref: https://en.cppreference.com/w/cpp/utility/program/EXIT_status

Before you start working on your fork make sure, to pull upstream and make sure you have all the latest changes from the repo. Make your changes on the dev branch and open a pull request on dev.

Any ideas on how long this might take for you to do?

Running a simple grep on my terminal gave me this output, there might be more, only do this for the src/ subdirectory, don't bother with the libraries in lib.

src/sensor_ms5611.cpp:bool init_MS5611() 
src/sensor_kx134.cpp:bool init_kx134()
src/sensor_kx134.cpp:bool confirm_acceleration_z()
src/main.cpp:bool apogee_check() 
include/sensor_ms5611.h:bool init_MS5611();
include/sensor_kx134.h:bool init_kx134();
MostlyGenius commented 1 year ago

Will finish it this Sunday. I am an accountant by day so super busy. Will note here when I am done

frroossst commented 1 year ago

No worries, thanks for the help!

PS: This is a very active repo so please make sure your fork is in sync with this repo before you make any changes, and please make your changes on the dev branch else you won't be able to commit your changes