8000 Update ble_uart_ftp.py with latest ble uart write changes, remove tim… · kitlab-io/micropython@c5bb6a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5bb6a3

Browse files
Update ble_uart_ftp.py with latest ble uart write changes, remove timer and _flush
1 parent 6e9fbda commit c5bb6a3

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

jem/ble_uart_ftp.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
# FTP over BLE UART
2-
from ble_uart_peripheral import schedule_in
32
from cmd import *
43

54
class BLEUARTFTP:
6-
def __init__(self, tmr, uart):
5+
def __init__(self, uart):
76
self._uart = uart
8-
self._tx_buf = bytearray()
9-
self.tx_max_len = 100
10-
self.tx_delay_ms = 20
11-
self._timer = tmr
127
self._uart.irq(self._on_rx)
138
self.ftp_cmd_manager = CmdManager()
149

@@ -35,15 +30,5 @@ def update(self, data):
3530
if resp:
3631
self.write(resp)
3732

38-
def _flush(self):
39-
data = self._tx_buf[0:self.tx_max_len]
40-
self._tx_buf = self._tx_buf[self.tx_max_len:]
41-
self._uart.write(data)
42-
if self._tx_buf:
43-
schedule_in(self._timer, self._flush, self.tx_delay_ms)
44-
4533
def write(self, buf):
46-
empty = not self._tx_buf
47-
self._tx_buf += buf
48-
if empty:
49-
schedule_in(self._timer, self._flush, self.tx_delay_ms)
34+
self._uart.write(buf)

0 commit comments

Comments
 (0)
0