File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ void bluetooth_setup(bool factory_reset)
368368 ble_cfg_t cfg ;
369369 cfg .conn_cfg .conn_cfg_tag = 1 ;
370370 cfg .conn_cfg .params .gap_conn_cfg .conn_count = 1 ;
371- cfg .conn_cfg .params .gap_conn_cfg .event_length = 300 ;
371+ cfg .conn_cfg .params .gap_conn_cfg .event_length = ( 15 * 1000 ) / 1250 ;
372372 check_error (sd_ble_cfg_set (BLE_CONN_CFG_GAP , & cfg , ram_start ));
373373
374374 // Set BLE role to peripheral only
Original file line number Diff line number Diff line change 2828#include <stddef.h>
2929#include <stdint.h>
3030
31- #define BLE_PREFERRED_MAX_MTU 256
31+ #define BLE_PREFERRED_MAX_MTU 185
3232extern uint16_t ble_negotiated_mtu ;
3333
3434void bluetooth_setup (bool factory_reset );
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ ENTRY(Reset_Handler)
5151MEMORY
5252{
5353 APPLICATION_FLASH (rx) : ORIGIN = 0x27000 , LENGTH = 0xCE000
54- APPLICATION_RAM (rwx) : ORIGIN = 0x20002A08 , LENGTH = 256K - 0x2A08
54+ APPLICATION_RAM (rwx) : ORIGIN = 0x200026F8 , LENGTH = 256K - 0x26F8
5555
5656 BOOTLOADER_FLASH (rx) : ORIGIN = 0xF5000 , LENGTH = 0x9000
5757 BOOTLOADER_RAM (rwx) : ORIGIN = 0x20002AE8 , LENGTH = 256K - 0x2AE8
Original file line number Diff line number Diff line change 11from aioconsole import ainput
22from frameutils import Bluetooth
33import asyncio
4+ import time
45
56header = bytearray (
67 [
631632)
632633
633634image_buffer = b""
635+ last_fps_time = time .time ()
636+ fps = 0
634637
635638
636639def receive_data (data ):
637640 global image_buffer
641+ global last_fps_time
642+ global fps
638643
639644 if len (data ) == 1 :
640645 with open ("temp_focus_image.jpg" , "wb" ) as f :
641646 f .write (header + image_buffer )
642647 image_buffer = b""
648+ fps = 1 / (time .time () - last_fps_time )
649+ last_fps_time = time .time ()
643650 return
644651
645652 image_buffer += data [1 :]
646653 print (
647- f"Received { str (len (image_buffer )- 1 )} bytes. Press enter to finish " ,
654+ f"Received { str (len (image_buffer )- 1 )} bytes. FPS = { fps } . Press enter to finish " ,
648655 end = "\r " ,
649656 )
650657
@@ -658,11 +665,11 @@ async def main():
658665
659666 while true do
660667 if state == 'CAPTURE' then
661- frame.camera.capture { quality_factor = 25 }
668+ frame.camera.capture { quality_factor = 50 }
662669 state_time = frame.time.utc()
663670 state = 'WAIT'
664671 elseif state == 'WAIT' then
665- if frame.time.utc() > state_time + 0.2 then
672+ if frame.time.utc() > state_time + 0.1 then
666673 state = 'SEND'
667674 end
668675 elseif state == 'SEND' then
You can’t perform that action at this time.
0 commit comments