@@ -739,7 +739,7 @@ void HeadingBoard::pressure(int& temp, int& pres) const {
739
739
int dUT = (D2 - C5) - (corr * (long ) corr * (D2 >= C5 ? A : B) >> C);
740
740
// Serial.print("dUT = ");
741
741
// Serial.println(dUT);
742
- temp = 250 + (dUT * C6 >> 16 ) - (dUT >> D);
742
+ temp = 250 + (( long ) dUT * C6 >> 16 ) - (dUT >> D);
743
743
744
744
word D1 = adcValue (1 );
745
745
// Serial.print("D1 = ");
@@ -773,7 +773,7 @@ void HeadingBoard::heading(int& xaxis, int& yaxis) {
773
773
compass.send ();
774
774
compass.write (0x00 );
775
775
compass.receive ();
776
- byte tmp, reg = compass.read (0 );
776
+ byte tmp = compass.read (0 );
777
777
tmp = compass.read (0 );
778
778
xaxis = ((tmp << 8 ) | compass.read (0 )) - 2048 ;
779
779
tmp = compass.read (0 );
@@ -797,7 +797,7 @@ float CompassBoard::heading () {
797
797
write (0x00 ); // Mode: Continuous-Measurement Mode
798
798
receive ();
799
799
int x = read2 (0 );
800
- int z = read2 (0 );
800
+ /* int z = */ read2 (0 );
801
801
int y = read2 (1 );
802
802
stop ();
803
803
@@ -829,7 +829,7 @@ void InfraredPlug::poll() {
829
829
memset (buf, 0 , sizeof buf);
830
830
}
831
831
// act only if the bit changed, using the low bit of the nibble fill count
832
- if (bit != (fill & 1 ) && fill < 2 * sizeof buf) {
832
+ if (bit != (fill & 1 ) && fill < 2 * ( int ) sizeof buf) {
833
833
uint32_t curr = micros (), diff = (curr - prev + 2 ) >> 2 ;
834
834
if (diff > 65000 )
835
835
diff = 65000 ; // * 4 us, i.e. 260 ms
@@ -871,7 +871,7 @@ uint8_t InfraredPlug::decoder(uint8_t nibbles) {
871
871
return UNKNOWN;
872
872
// valid packet, convert in-place
873
873
for (byte i = 0 ; i < 4 ; ++i) {
874
- byte v;
874
+ byte v = 0 ;
875
875
for (byte j = 0 ; j < 8 ; ++j)
876
876
v = (v << 1 ) | (buf[1 +j+8 *i] >> 5 );
877
877
buf[i] = v;
@@ -1054,7 +1054,7 @@ void Sleepy::powerDown () {
1054
1054
// sleep_bod_disable(); // can't use this - not in my avr-libc version!
1055
1055
#ifdef BODSE
1056
1056
MCUCR = MCUCR | bit (BODSE) | bit (BODS); // timed sequence
1057
- MCUCR = MCUCR & ~ bit (BODSE) | bit (BODS);
1057
+ MCUCR = ( MCUCR & ~ bit (BODSE) ) | bit (BODS);
1058
1058
#endif
1059
1059
}
1060
1060
sleep_cpu ();
@@ -1101,13 +1101,13 @@ void Sleepy::watchdogEvent() {
1101
1101
++watchdogCounter;
1102
1102
}
1103
1103
1104
- Scheduler::Scheduler (byte size) : maxTasks (size ), remaining (~ 0 ) {
1104
+ Scheduler::Scheduler (byte size) : remaining (~ 0 ), maxTasks (size ) {
1105
1105
byte bytes = size * sizeof *tasks;
1106
1106
tasks = (word*) malloc (bytes);
1107
1107
memset (tasks, 0xFF , bytes);
1108
1108
}
1109
1109
1110
- Scheduler::Scheduler (word* buf, byte size) : tasks (buf), maxTasks (size ), remaining(~ 0 ) {
1110
+ Scheduler::Scheduler (word* buf, byte size) : tasks (buf), remaining(~ 0 ), maxTasks (size ) {
1111
1111
byte bytes = size * sizeof *tasks;
1112
1112
memset (tasks, 0xFF , bytes);
1113
1113
}
@@ -1125,23 +1125,23 @@ char Scheduler::poll() {
1125
1125
if (tasks[i] < lowest)
1126
1126
lowest = tasks[i];
1127
1127
}
1128
- if (lowest != ~0 ) {
1128
+ if (lowest != ~0U ) {
1129
1129
for (byte i = 0 ; i < maxTasks; ++i) {
1130
- if (tasks[i] != ~0 ) {
1130
+ if (tasks[i] != ~0U ) {
1131
1131
tasks[i] -= lowest;
1132
1132
}
1133
1133
}
1134
1134
}
1135
1135
remaining = lowest;
1136
- } else if (remaining == ~0 ) // remaining == ~0 means nothing running
1136
+ } else if (remaining == ~0U ) // remaining == ~0 means nothing running
1137
1137
return -2 ;
1138
1138
else if (ms100.poll (100 ))
1139
1139
--remaining;
1140
1140
return -1 ;
1141
1141
}
1142
1142
1143
1143
char Scheduler::pollWaiting () {
1144
- if (remaining == ~0 ) // Nothing running!
1144
+ if (remaining == ~0U ) // Nothing running!
1145
1145
return -2 ;
1146
1146
// first wait until the remaining time we need to wait is less than 0.1s
1147
1147
while (remaining > 0 ) {
@@ -1162,7 +1162,7 @@ void Scheduler::timer(byte task, word tenths) {
1162
1162
if (tenths < remaining) {
1163
1163
word diff = remaining - tenths;
1164
1164
for (byte i = 0 ; i < maxTasks; ++i)
1165
- if (tasks[i] != ~0 )
1165
+ if (tasks[i] != ~0U )
1166
1166
tasks[i] += diff;
1167
1167
remaining = tenths;
1168
1168
}
@@ -1212,9 +1212,9 @@ void InputParser::poll() {
1212
1212
buffer[fill++] = ch;
1213
1213
return ;
1214
1214
}
1215
- if (hexmode && (' 0' <= ch && ch <= ' 9' ||
1216
- ' A' <= ch && ch <= ' F' ||
1217
- ' a' <= ch && ch <= ' f' )) {
1215
+ if (hexmode && (( ' 0' <= ch && ch <= ' 9' ) ||
1216
+ ( ' A' <= ch && ch <= ' F' ) ||
1217
+ ( ' a' <= ch && ch <= ' f' ) )) {
1218
1218
if (!hasvalue)
1219
1219
value = 0 ;
1220
1220
if (ch > ' 9' )
0 commit comments