Skip to content

Commit 8e8aa92

Browse files
authored
Merge pull request #24 from winemug/dev
merge for v1.4.3
2 parents 3437fe2 + c9739e1 commit 8e8aa92

19 files changed

+49
-55
lines changed

.gitignore

100755100644
File mode changed.

batt_check.py

100755100644
File mode changed.

omni.py

100755100644
File mode changed.

podcomm/definitions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
API_VERSION_MAJOR = 1
2626
API_VERSION_MINOR = 4
27-
API_VERSION_REVISION = 2
28-
API_VERSION_BUILD = 19210
27+
API_VERSION_REVISION = 3
28+
API_VERSION_BUILD = 19212
2929

3030
REST_URL_PING = "/omnipy/ping"
3131
REST_URL_OMNIPY_SHUTDOWN = "/omnipy/shutdown"

podcomm/pdm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,16 +545,16 @@ def activate_pod(self):
545545
self.logger.debug("Activating pod")
546546
self.pod.last_command = {"command": "ACTIVATE",
547547
"success": False}
548+
radio = self.get_radio(new=True)
548549
self._internal_update_status()
549550
if self.pod.state_progress > PodProgress.ReadyForInjection:
550551
raise PdmError("Pod is already activated")
551552

552-
radio = None
553553
if self.pod.state_progress == PodProgress.PairingSuccess:
554554
if radio is not None:
555555
self.pod.radio_packet_sequence = radio.packet_sequence
556556

557-
radio = self.get_radio(new=True)
557+
558558
radio.radio_address = self.pod.radio_address
559559
radio.message_sequence = 2
560560

podcomm/pr_rileylink.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ class Encoding(IntEnum):
7979
FOURBSIXB = 2
8080

8181

82-
PA_LEVELS = [0x12,
83-
0x0E, 0x0E,
84-
0x1D, 0x1D,
85-
0x34, 0x34, 0x34,
86-
0x2C, 0x2C, 0x2C, 0x2C,
87-
0x60, 0x60, 0x60, 0x60,
88-
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
89-
0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8,
90-
0xC0, 0xC0]
82+
PA_LEVELS = [0x0E,
83+
0x1D,
84+
0x34,
85+
0x2C,
86+
0x60,
87+
0x84, 0x84,
88+
0xC8]
9189

9290
g_rl_address = None
9391
g_rl_version = None
@@ -346,7 +344,7 @@ def set_tx_power(self, tx_power):
346344
elif tx_power == TxPower.High:
347345
self._set_amp(PA_LEVELS.index(0xC8))
348346
elif tx_power == TxPower.Highest:
349-
self._set_amp(PA_LEVELS.index(0xC0))
347+
self._set_amp(PA_LEVELS.index(0xC8))
350348
except Exception as e:
351349
raise PacketRadioError("Error while setting tx level") from e
352350

podcomm/protocol_radio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def _kill_btle_subprocess(self):
218218

219219
def _reset_sequences(self):
220220
self.packet_sequence = 0
221-
self.message_sequence = 0
221+
self.message_sequence = (self.message_sequence + 1) % 16
222222

223223
def _send_and_get(self, pdm_message, pdm_message_address, ack_address_override=None,
224224
tx_power=None, double_take=False, expect_critical_follow_up=False):
@@ -274,17 +274,16 @@ def _send_and_get(self, pdm_message, pdm_message_address, ack_address_override=N
274274
timeout = 15
275275
continue
276276
elif repeat_count == 1:
277-
self._reset_sequences()
278277
timeout = 10
279278
time.sleep(2)
280279
continue
281280
elif repeat_count == 2:
282-
self._reset_sequences()
283281
self._radio_init()
284282
timeout = 15
285283
continue
286284
else:
287285
self.logger.debug("Failed recovery")
286+
self._reset_sequences()
288287
raise
289288
elif part < packet_count - 1:
290289
if repeat_count < 2:
@@ -337,6 +336,7 @@ def _send_and_get(self, pdm_message, pdm_message_address, ack_address_override=N
337336
except RecoverableProtocolError as rpe:
338337
self.logger.debug("Trying to recover from protocol error")
339338
self.packet_sequence = (rpe.packet.sequence + 1) % 32
339+
self.message_sequence = (self.message_sequence + 1) % 16
340340
if expected_type == RadioPacketType.POD and rpe.packet.type == RadioPacketType.ACK:
341341
raise StatusUpdateRequired()
342342
continue

restapi.py

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
app = Flask(__name__, static_url_path="/")
3232
configureLogging()
33-
logger = getLogger(with_console=False)
34-
get_packet_logger(with_console=False)
33+
logger = getLogger(with_console=True)
34+
get_packet_logger(with_console=True)
3535

3636

3737
class RestApiException(Exception):

scripts/bt-nap.sh

100755100644
File mode changed.

scripts/bt-reset.sh

100755100644
File mode changed.

0 commit comments

Comments
 (0)