Skip to content

Commit 3419ea3

Browse files
committed
fix: formatting
fix: test build (Arduino code)
1 parent 08f1962 commit 3419ea3

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/ir_Electrolux.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ void IRElectroluxAc::setTemp(const uint8_t degrees)
154154
{
155155
uint8_t temp = max(kElectroluxAcMinTemp, degrees);
156156
temp = min(kElectroluxAcMaxTemp, temp);
157+
#ifndef UNIT_TEST
157158
temp = map(temp, kElectroluxAcMinTemp, kElectroluxAcMaxTemp, kElectroluxAcMinFTemp, kElectroluxAcMaxFTemp);
159+
#else
160+
temp = temp * 9 / 5 + 32;
161+
#endif
158162
_.Temp = temp - kElectroluxAcMinFTemp;
159163
}
160164
}
@@ -169,7 +173,11 @@ uint8_t IRElectroluxAc::getTemp(void) const
169173
}
170174
else
171175
{
176+
#ifndef UNIT_TEST
172177
uint8_t temp = map(_.Temp + kElectroluxAcMinFTemp, kElectroluxAcMinFTemp, kElectroluxAcMaxFTemp, kElectroluxAcMinTemp, kElectroluxAcMaxTemp);
178+
#else
179+
uint8_t temp = ((_.Temp + kElectroluxAcMinFTemp) - 32) * 5 / 9;
180+
#endif
173181
return temp;
174182
}
175183
}

tools/serial_parser.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55

66

77
def substring_after(str: str, searchStr: str):
8-
return str[str.index(searchStr) + len(searchStr) :]
8+
return str[str.index(searchStr) + len(searchStr):]
99

1010

1111
def getPort():
1212
ports = sorted(serial.tools.list_ports.comports())
1313
print("Available ports to listing:")
1414
for id, portInfo in enumerate(ports):
15-
print(
16-
"{}. - {}: {} [{}]".format(
17-
id, portInfo.device, portInfo.description, portInfo.hwid
18-
)
19-
)
15+
print("{}. - {}: {} [{}]".format(id, portInfo.device,
16+
portInfo.description, portInfo.hwid))
2017
print("Select port: ", end="")
2118
selectId = int(input())
2219
if selectId < len(ports) and selectId >= 0:
@@ -71,9 +68,8 @@ def main():
7168
continue
7269
# print(dataStr)
7370
if "uint16_t rawData" in dataStr:
74-
dataStrArray = str(
75-
dataStr[dataStr.index("{") + 1 : dataStr.index("}")]
76-
).split(",")
71+
dataStrArray = str(dataStr[dataStr.index("{") +
72+
1:dataStr.index("}")]).split(",")
7773
data = [int(i.strip()) for i in dataStrArray]
7874
data = data[2:]
7975
clearData = [i for idi, i in enumerate(data) if idi % 2 == 1]
@@ -92,13 +88,6 @@ def main():
9288
oSum += d
9389
oCnt += 1
9490

95-
# print("zero = " + str(zSum/zCnt) + " one = " + str(oSum/oCnt) + " space = " + str(sSum/sCnt))\
96-
97-
# print("Data = ", end="")
98-
# print(data)
99-
# print("0b"+ "".join([str(i) for i in bitData]))
100-
# print("ClearData = ", end="")
101-
# print(clearData)
10291
print("".join([str(i) for i in clearBitData]))
10392

10493

0 commit comments

Comments
 (0)