Skip to content

Commit a90071b

Browse files
committedMar 4, 2025
delayMicros for extraWake, some type static casts
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
1 parent 87a1b96 commit a90071b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed
 

‎src/SDI12.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ void SDI12::wakeSensors(int8_t extraWakeTime) {
385385
digitalWrite(_dataPin, HIGH); // break is HIGH
386386
delayMicroseconds(
387387
SDI12_LINE_BREAK_MICROS); // Required break of 12 milliseconds (12,000 µs)
388-
delay(extraWakeTime); // allow the sensors to wake
388+
delayMicroseconds(extraWakeTime * 1000); // allow the sensors to wake
389389
digitalWrite(_dataPin, LOW); // marking is LOW
390390
delayMicroseconds(
391391
SDI12_LINE_MARK_MICROS); // Required marking of 8.33 milliseconds(8,333 µs)

‎src/SDI12.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ typedef const __FlashStringHelper* FlashString;
156156
* digits + the decimal point))
157157
* - The polarity symbol (+ or -) acts as a delimeter between the numeric values
158158
*/
159-
#define SDI12_VALUE_STR_SIZE
159+
#define SDI12_VALUE_STR_SIZE 9
160160
/**
161161
* @brief The maximum length of a standard data command response
162162
*

‎src/SDI12_boards.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ uint16_t SDI12Timer::mul8x8to16(uint8_t x, uint8_t y) {
2626
#if TIMER_INT_SIZE == 8
2727
uint16_t SDI12Timer::bitTimes(sdi12timer_t dt) {
2828
// multiply the time delta in ticks by the bits per tick
29-
return mul8x8to16(dt + RX_WINDOW_FUDGE, BITS_PER_TICK_Q10) >> 10;
29+
return mul8x8to16(dt + static_cast<uint8_t>(RX_WINDOW_FUDGE),
30+
static_cast<uint8_t>(BITS_PER_TICK_Q10)) >>
31+
10;
3032
}
3133

3234
// But nothing fancy for bigger timers

0 commit comments

Comments
 (0)