Skip to content

Commit 6bb817b

Browse files
committed
Remove timeout logic that disables LDO
1 parent 405a073 commit 6bb817b

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

src/Arduino_BHY2.cpp

+13-21
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Arduino_BHY2::Arduino_BHY2() :
1414
_debug(NULL),
1515
_pingTime(0),
1616
_timeout(120000),
17-
_timeoutExpired(false),
1817
_eslovActive(false),
1918
_startTime(0),
2019
_eslovIntPin(PIN_ESLOV_INT),
@@ -37,25 +36,18 @@ void Arduino_BHY2::pingI2C() {
3736
}
3837

3938
void Arduino_BHY2::checkEslovInt() {
40-
if (millis() - _startTime < _timeout) {
41-
//Timeout didn't expire yet
42-
if (!digitalRead(_eslovIntPin)) {
43-
//Wait for MKR to clear Eslov Int pin
44-
while(!digitalRead(_eslovIntPin)) {}
45-
if (_debug) _debug->println("MKR released Eslov Int pin");
46-
47-
//Change mode for Eslov Int pin
48-
//Eslov Int Pin will be used to synchronize Dfu via Eslov
49-
pinMode(_eslovIntPin, OUTPUT);
50-
51-
eslovHandler.begin();
52-
//Eslov has been activated
53-
_eslovActive = true;
54-
}
55-
} else {
56-
//Timeout expired
57-
_timeoutExpired = true;
58-
nicla::disableLDO();
39+
if (!digitalRead(_eslovIntPin)) {
40+
//Wait for MKR to clear Eslov Int pin
41+
while(!digitalRead(_eslovIntPin)) {}
42+
if (_debug) _debug->println("MKR released Eslov Int pin");
43+
44+
//Change mode for Eslov Int pin
45+
//Eslov Int Pin will be used to synchronize Dfu via Eslov
46+
pinMode(_eslovIntPin, OUTPUT);
47+
48+
eslovHandler.begin();
49+
//Eslov has been activated
50+
_eslovActive = true;
5951
}
6052
}
6153

@@ -122,7 +114,7 @@ void Arduino_BHY2::update()
122114
pingI2C();
123115

124116
if (_niclaConfig & NICLA_I2C) {
125-
if (!_timeoutExpired && !_eslovActive) {
117+
if (!_eslovActive) {
126118
checkEslovInt();
127119
}
128120
}

src/Arduino_BHY2.h

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class Arduino_BHY2 {
7575
int _pingTime;
7676
int _timeout;
7777
int _startTime;
78-
bool _timeoutExpired;
7978
bool _eslovActive;
8079

8180
PinName _eslovIntPin;

0 commit comments

Comments
 (0)