File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change 1
1
# FTP over BLE UART
2
- from ble_uart_peripheral import schedule_in
3
2
from cmd import *
4
3
5
4
class BLEUARTFTP :
6
- def __init__ (self , tmr , uart ):
5
+ def __init__ (self , uart ):
7
6
self ._uart = uart
8
- self ._tx_buf = bytearray ()
9
- self .tx_max_len = 100
10
- self .tx_delay_ms = 20
11
- self ._timer = tmr
12
7
self ._uart .irq (self ._on_rx )
13
8
self .ftp_cmd_manager = CmdManager ()
14
9
@@ -35,15 +30,5 @@ def update(self, data):
35
30
if resp :
36
31
self .write (resp )
37
32
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
-
45
33
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 )
You can’t perform that action at this time.
0 commit comments