@@ -26,7 +26,7 @@ const String LEGAL_COMMANDS[] = {"submerge", "suck", "pump", "stop", "return"};
2626void setup () {
2727 Serial.begin (115200 );
2828 // Wait until serial console is open; remove if not tethered to computer
29- while (!Serial) {}
29+ while (!Serial);
3030
3131 Serial.println (" Surface Transceiver" );
3232 pinMode (RFM95_RST, OUTPUT);
@@ -41,7 +41,7 @@ void setup() {
4141
4242 if (!rf95.init ()) {
4343 Serial.println (" RFM95 radio init failed" );
44- while (1 ) {}
44+ while (1 );
4545 }
4646 Serial.println (" RFM95 radio init OK!" );
4747
@@ -50,7 +50,7 @@ void setup() {
5050 // But we override frequency
5151 if (!rf95.setFrequency (RF95_FREQ)) {
5252 Serial.println (" setFrequency failed" );
53- while (1 ) {}
53+ while (1 );
5454 }
5555
5656 // The default transmitter power is 13dBm, using PA_BOOST.
@@ -68,12 +68,12 @@ void loop() {
6868 Serial.println (" Getting serial command..." );
6969 String command = Serial.readString ();
7070
71- if (command.startsWith (" submerge" )) {
71+ if (command.equals (" submerge" )) {
7272 printRFStatus = false ;
7373 }
7474
7575 for (auto legalCommand : LEGAL_COMMANDS) {
76- if (command.startsWith (legalCommand)) {
76+ if (command.equals (legalCommand)) {
7777 sendCommand (legalCommand);
7878 return ;
7979 }
@@ -158,8 +158,8 @@ bool receivePacket() {
158158 byteBuffer[PKT_IDX_PROFILE_HALF]);
159159 for (int i = PKT_HEADER_LEN; i < len;) {
160160 // Wonky pointer casting to convert four bytes into a long (time)
161- serialPrintf (" %l," , *reinterpret_cast <uint32_t *>(byteBuffer + i));
162- i += sizeof (uint32_t );
161+ serialPrintf (" %l," , *reinterpret_cast <unsigned long *>(byteBuffer + i));
162+ i += sizeof (unsigned long );
163163
164164 // Same thing for a float (pressure)
165165 Serial.print (*reinterpret_cast <float *>(byteBuffer + i));
0 commit comments