Skip to content

Commit

Permalink
added test, fixed some macros I changed
Browse files Browse the repository at this point in the history
  • Loading branch information
superjax committed Jan 26, 2018
1 parent 76584f8 commit 9ab9f94
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/eeprom/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ int main() {
//To write, uncomment this
data.version=1;
data.someOtherValue=3.14154f;
memory_write((&data),sizeof(data));
eeprom_write((&data),sizeof(data));

//to read, uncomment this
memory_read(&data,sizeof(data));
eeprom_read(&data,sizeof(data));


printf("version: %d",data.version);
Expand Down
4 changes: 2 additions & 2 deletions examples/i2c_airspeed/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main() {

info.on();
I2C i2c1;
i2c1.init(&i2c_config[MS4525_I2C]);
i2c1.init(&i2c_config[EXTERNAL_I2C]);
MS4525 airspeed;


Expand All @@ -48,7 +48,7 @@ int main() {
airspeed.update();
if (airspeed.present())
{
airspeed.read(diff_press, temp);
airspeed.read(&diff_press, &temp);
warn.off();
printf("%d.%dPa, %d.%dC\n",
(int32_t)(diff_press), (int32_t)(diff_press*1000)%1000,
Expand Down
2 changes: 1 addition & 1 deletion examples/i2c_baro/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main() {

info.on();
I2C i2c1;
i2c1.init(&i2c_config[MS5611_I2C]);
i2c1.init(&i2c_config[BARO_I2C]);
MS5611 baro;

if (!baro.init(&i2c1))
Expand Down
38 changes: 38 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

function echo_red { echo -e "\033[1;31m$@\033[0m"; }
function echo_green { echo -e "\033[1;32m$@\033[0m"; }
function echo_blue { echo -e "\033[1;34m$@\033[0m"; }



EXIT_CODE=0

function print_result() {
if [ $1 -eq 0 ]; then
echo_green "[Passed]"
else
echo_red "[Failed]"
EXIT_CODE=1
fi
echo ""
}


for example in `find examples/ -maxdepth 1 -mindepth 1 -type d`
do
cd $example
echo_blue $example
make -j4 -l4
print_result $?
cd ../..
done

if [ $EXIT_CODE -eq 0 ]; then
echo_green "All examples built!"
else
echo_red "There were failed examples"
fi

exit $EXIT_CODE

0 comments on commit 9ab9f94

Please sign in to comment.