Skip to content

Commit

Permalink
Merge pull request #120 from ronzeiller/rz_nitpicks
Browse files Browse the repository at this point in the history
some nitpicks
  • Loading branch information
sarfata authored Jan 11, 2018
2 parents 9339b8d + 86b0b01 commit 37ee8b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/KBoxHardware/src/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static const pin_t nmea2_out_enable = 16;
#define NMEA1_SERIAL Serial2
#define NMEA2_SERIAL Serial3

/* Analag Inputs */
/* Analog Inputs */
#ifdef BOARD_v1_revA
static const pin_t adc1_analog = A10;
static const pin_t adc2_analog = A11;
Expand All @@ -97,4 +97,4 @@ static const float analog_max_voltage = 3.0 / (10000/(10000+56000.0));
static const pin_t supply_analog = A14;

/* SDCard Interface */
static const pin_t sdcard_cs = 15;
static const pin_t sdcard_cs = 15;
5 changes: 1 addition & 4 deletions src/common/signalk/SKNMEAParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ const SKUpdate& SKNMEAParser::parseMWV(const SKSourceInput& input, NMEASentenceR

// Wind sensors return a number between 0 and 360 but we want an
// angle in radian with negative values when wind coming from port
if (windAngle > 180) {
windAngle = windAngle - 360;
}
windAngle = SKDegToRad(windAngle);
windAngle = SKNormalizeAngle(SKDegToRad(windAngle));

SKUpdateStatic<2>* wmv = new SKUpdateStatic<2>();
wmv->setTimestamp(time);
Expand Down
10 changes: 8 additions & 2 deletions src/test/signalk/SKNMEAParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ TEST_CASE("SKNMEAParser: MWV") {
CHECK( update.getSource() != SKSourceUnknown );
CHECK( update.getContext() == SKContextSelf );
CHECK( update.getTimestamp().getTime() == 42 );
CHECK( update.getEnvironmentWindSpeedApparent() == SKKnotToMs(5.19) );
CHECK( update.getEnvironmentWindAngleApparent() == SKDegToRad(56) );
CHECK( update.getEnvironmentWindSpeedApparent() == Approx(SKKnotToMs(5.19)) );
CHECK( update.getEnvironmentWindAngleApparent() == Approx(SKDegToRad(56)) );
}
SECTION("MWV true") {
const SKUpdate& update = p.parse(SKSourceInputNMEA0183_1, "$IIMWV,027,T,3.82,N,A*19", SKTime(42));
Expand Down Expand Up @@ -111,6 +111,12 @@ TEST_CASE("SKNMEAParser: MWV") {

CHECK( update.getSize() == 0 );
}
SECTION("MWV relative with wind angle > 180") {
// Unit S seems to be knots but I cannot find a real source here.
const SKUpdate& update = p.parse(SKSourceInputNMEA0183_1, "$WIMWV,271,R,5.6,K,A*3F", SKTime(42));

CHECK( update.getEnvironmentWindAngleApparent() == Approx(SKDegToRad(-89)) );
}
}

TEST_CASE("SKNMEAParser: XDR wind temperature") {
Expand Down

0 comments on commit 37ee8b3

Please sign in to comment.