[update] fix spi reset
This commit is contained in:
@@ -506,8 +506,6 @@ class DataServer(SocketServer, DataAPI):
|
||||
# start sync
|
||||
for runtime in r:
|
||||
if runtime is not None and not runtime.sync_started:
|
||||
# if isinstance(runtime, DeviceDataRuntime):
|
||||
# self.spi_flush(runtime.device)
|
||||
|
||||
# if client is not None:
|
||||
# client.drop_data(runtime.device)
|
||||
@@ -562,23 +560,6 @@ class DataServer(SocketServer, DataAPI):
|
||||
self.mqtt_thread.broadcast_command('stop:' + str(c._device))
|
||||
# r.append(c)
|
||||
|
||||
# stop sync
|
||||
# for runtime in r:
|
||||
# if runtime is not None and runtime.sync_started:
|
||||
# self.log_info('stop_sync', runtime.device)
|
||||
# self.mqtt_thread.broadcast_command('stop:' + str(runtime.device))
|
||||
|
||||
# try:
|
||||
# runtime.shutdown()
|
||||
# except:
|
||||
# print_exception(self)
|
||||
|
||||
# # finally:
|
||||
# # # self.spi_flush(runtime.device)
|
||||
# # if _FLAG_DATA_LOST_STATS_:
|
||||
# # if isinstance(runtime, DeviceDataRuntime):
|
||||
# # runtime.log_data_receive_statistics(self)
|
||||
# # runtime.shutdown()
|
||||
|
||||
# stop runtime, none device working
|
||||
if not self.sync_started:
|
||||
@@ -780,30 +761,6 @@ class DataServer(SocketServer, DataAPI):
|
||||
|
||||
return
|
||||
|
||||
def spi_flush(self, device: int):
|
||||
"""clean spi buffer"""
|
||||
|
||||
if self._spi is not None:
|
||||
self._spi.select = device
|
||||
return
|
||||
|
||||
def spi_reset_ram_header(self, device: int):
|
||||
if self._spi is not None:
|
||||
self._spi.select = device
|
||||
self._spi.mem_request()
|
||||
sleep(0.01)
|
||||
self._spi.reset()
|
||||
return
|
||||
|
||||
def spi_send(self, device: int, address: int, data: bytes):
|
||||
sync = self._spi
|
||||
|
||||
if sync is None:
|
||||
return
|
||||
|
||||
sync.select = device
|
||||
sync.write_memory(address, data)
|
||||
return
|
||||
|
||||
def spi_recv(self, device: int) -> Optional[bytes]:
|
||||
sync = self._spi
|
||||
|
||||
Reference in New Issue
Block a user