mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-20 04:54:45 -07:00
Spring cleaning
This commit is contained in:
@@ -787,7 +787,6 @@ Function,+,ble_svc_serial_start,BleServiceSerial*,
|
||||
Function,+,ble_svc_serial_stop,void,BleServiceSerial*
|
||||
Function,+,ble_svc_serial_update_tx,_Bool,"BleServiceSerial*, uint8_t*, uint16_t"
|
||||
Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t"
|
||||
Function,-,bt_close_rpc_connection,void,Bt*
|
||||
Function,+,bt_disconnect,void,Bt*
|
||||
Function,+,bt_forget_bonded_devices,void,Bt*
|
||||
Function,+,bt_keys_storage_alloc,BtKeysStorage*,const char*
|
||||
@@ -800,10 +799,8 @@ Function,+,bt_keys_storage_set_file_path,void,"BtKeysStorage*, const char*"
|
||||
Function,+,bt_keys_storage_set_ram_params,void,"BtKeysStorage*, uint8_t*, uint16_t"
|
||||
Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*"
|
||||
Function,+,bt_keys_storage_update,_Bool,"BtKeysStorage*, uint8_t*, uint32_t"
|
||||
Function,-,bt_open_rpc_connection,void,Bt*
|
||||
Function,+,bt_profile_restore_default,_Bool,Bt*
|
||||
Function,+,bt_profile_start,FuriHalBleProfileBase*,"Bt*, const FuriHalBleProfileTemplate*, FuriHalBleProfileParams"
|
||||
Function,+,bt_remote_rssi,_Bool,"Bt*, uint8_t*"
|
||||
Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*"
|
||||
Function,+,buffered_file_stream_alloc,Stream*,Storage*
|
||||
Function,+,buffered_file_stream_close,_Bool,Stream*
|
||||
@@ -996,8 +993,8 @@ Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
||||
Function,+,dolphin_flush,void,Dolphin*
|
||||
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
||||
Function,+,dolphin_get_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_reload_state,void,Dolphin*
|
||||
Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
||||
Function,+,dolphin_upgrade_level,void,Dolphin*
|
||||
Function,-,dprintf,int,"int, const char*, ..."
|
||||
@@ -1338,7 +1335,6 @@ Function,+,furi_hal_bt_extra_beacon_set_config,_Bool,const GapExtraBeaconConfig*
|
||||
Function,+,furi_hal_bt_extra_beacon_set_data,_Bool,"const uint8_t*, uint8_t"
|
||||
Function,+,furi_hal_bt_extra_beacon_start,_Bool,
|
||||
Function,+,furi_hal_bt_extra_beacon_stop,_Bool,
|
||||
Function,-,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t*
|
||||
Function,+,furi_hal_bt_get_key_storage_buff,void,"uint8_t**, uint16_t*"
|
||||
Function,+,furi_hal_bt_get_radio_stack,FuriHalBtStack,
|
||||
Function,+,furi_hal_bt_get_rssi,float,
|
||||
@@ -1346,7 +1342,6 @@ Function,+,furi_hal_bt_get_transmitted_packets,uint32_t,
|
||||
Function,-,furi_hal_bt_init,void,
|
||||
Function,+,furi_hal_bt_is_active,_Bool,
|
||||
Function,+,furi_hal_bt_is_alive,_Bool,
|
||||
Function,+,furi_hal_bt_is_connected,_Bool,
|
||||
Function,+,furi_hal_bt_is_gatt_gap_supported,_Bool,
|
||||
Function,+,furi_hal_bt_is_testing_supported,_Bool,
|
||||
Function,+,furi_hal_bt_lock_core2,void,
|
||||
@@ -2014,7 +2009,6 @@ Function,-,gap_extra_beacon_set_config,_Bool,const GapExtraBeaconConfig*
|
||||
Function,-,gap_extra_beacon_set_data,_Bool,"const uint8_t*, uint8_t"
|
||||
Function,-,gap_extra_beacon_start,_Bool,
|
||||
Function,-,gap_extra_beacon_stop,_Bool,
|
||||
Function,-,gap_get_remote_conn_rssi,uint32_t,int8_t*
|
||||
Function,-,gap_get_state,GapState,
|
||||
Function,-,gap_init,_Bool,"GapConfig*, GapEventCallback, void*"
|
||||
Function,-,gap_start_advertising,void,
|
||||
|
||||
|
@@ -33,8 +33,6 @@ typedef struct {
|
||||
GapConfig* config;
|
||||
GapConnectionParams connection_params;
|
||||
GapState state;
|
||||
int8_t conn_rssi;
|
||||
uint32_t time_rssi_sample;
|
||||
FuriMutex* state_mutex;
|
||||
GapEventCallback on_event_cb;
|
||||
void* context;
|
||||
@@ -65,19 +63,6 @@ static Gap* gap = NULL;
|
||||
static void gap_advertise_start(GapState new_state);
|
||||
static int32_t gap_app(void* context);
|
||||
|
||||
/** function for updating rssi informations in global Gap object
|
||||
*
|
||||
*/
|
||||
static inline void fetch_rssi(void) {
|
||||
uint8_t ret_rssi = 127;
|
||||
if(hci_read_rssi(gap->service.connection_handle, &ret_rssi) == BLE_STATUS_SUCCESS) {
|
||||
gap->conn_rssi = (int8_t)ret_rssi;
|
||||
gap->time_rssi_sample = furi_get_tick();
|
||||
return;
|
||||
}
|
||||
FURI_LOG_D(TAG, "Failed to read RSSI");
|
||||
}
|
||||
|
||||
static void gap_verify_connection_parameters(Gap* gap) {
|
||||
furi_check(gap);
|
||||
|
||||
@@ -181,9 +166,6 @@ BleEventFlowStatus ble_event_app_notification(void* pckt) {
|
||||
gap->connection_params.supervisor_timeout = event->Supervision_Timeout;
|
||||
FURI_LOG_I(TAG, "Connection parameters event complete");
|
||||
gap_verify_connection_parameters(gap);
|
||||
|
||||
// Save rssi for current connection
|
||||
fetch_rssi();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -301,9 +283,6 @@ BleEventFlowStatus ble_event_app_notification(void* pckt) {
|
||||
pairing_complete->Status);
|
||||
aci_gap_terminate(gap->service.connection_handle, 5);
|
||||
} else {
|
||||
// Save RSSI
|
||||
fetch_rssi();
|
||||
|
||||
FURI_LOG_I(TAG, "Pairing complete");
|
||||
GapEvent event = {.type = GapEventTypeConnected};
|
||||
gap->on_event_cb(event, gap->context); //-V595
|
||||
@@ -380,7 +359,7 @@ static void gap_init_svc(Gap* gap) {
|
||||
// Initialize GATT interface
|
||||
aci_gatt_init();
|
||||
// Initialize GAP interface
|
||||
// Skip first symbol AD_TYPE_COMPLETE_LOCAL_NAME
|
||||
// Skip fist symbol AD_TYPE_COMPLETE_LOCAL_NAME
|
||||
char* name = gap->service.adv_name + 1;
|
||||
aci_gap_init(
|
||||
GAP_PERIPHERAL_ROLE,
|
||||
@@ -550,7 +529,7 @@ void gap_stop_advertising(void) {
|
||||
furi_check(furi_mutex_release(gap->state_mutex) == FuriStatusOk);
|
||||
}
|
||||
|
||||
static void gap_advertise_timer_callback(void* context) {
|
||||
static void gap_advetise_timer_callback(void* context) {
|
||||
UNUSED(context);
|
||||
GapCommand command = GapCommandAdvLowPower;
|
||||
furi_check(furi_message_queue_put(gap->command_queue, &command, 0) == FuriStatusOk);
|
||||
@@ -566,7 +545,7 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) {
|
||||
gap = malloc(sizeof(Gap));
|
||||
gap->config = config;
|
||||
// Create advertising timer
|
||||
gap->advertise_timer = furi_timer_alloc(gap_advertise_timer_callback, FuriTimerTypeOnce, NULL);
|
||||
gap->advertise_timer = furi_timer_alloc(gap_advetise_timer_callback, FuriTimerTypeOnce, NULL);
|
||||
// Initialization of GATT & GAP layer
|
||||
gap->service.adv_name = config->adv_name;
|
||||
gap_init_svc(gap);
|
||||
@@ -577,9 +556,6 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) {
|
||||
gap->service.connection_handle = 0xFFFF;
|
||||
gap->enable_adv = true;
|
||||
|
||||
gap->conn_rssi = 127;
|
||||
gap->time_rssi_sample = 0;
|
||||
|
||||
// Command queue allocation
|
||||
gap->command_queue = furi_message_queue_alloc(8, sizeof(GapCommand));
|
||||
|
||||
@@ -619,17 +595,6 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get RSSI
|
||||
uint32_t gap_get_remote_conn_rssi(int8_t* rssi) {
|
||||
if(gap && gap->state == GapStateConnected) {
|
||||
fetch_rssi();
|
||||
*rssi = gap->conn_rssi;
|
||||
|
||||
if(gap->time_rssi_sample) return furi_get_tick() - gap->time_rssi_sample;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
GapState gap_get_state(void) {
|
||||
GapState state;
|
||||
if(gap) {
|
||||
|
||||
@@ -96,8 +96,6 @@ void gap_thread_stop(void);
|
||||
|
||||
void gap_emit_ble_beacon_status_event(bool active);
|
||||
|
||||
uint32_t gap_get_remote_conn_rssi(int8_t* rssi);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -251,10 +251,6 @@ bool furi_hal_bt_is_active(void) {
|
||||
return gap_get_state() > GapStateIdle;
|
||||
}
|
||||
|
||||
bool furi_hal_bt_is_connected(void) {
|
||||
return gap_get_state() == GapStateConnected;
|
||||
}
|
||||
|
||||
void furi_hal_bt_start_advertising(void) {
|
||||
if(gap_get_state() == GapStateIdle) {
|
||||
gap_start_advertising();
|
||||
@@ -391,21 +387,6 @@ float furi_hal_bt_get_rssi(void) {
|
||||
return val;
|
||||
}
|
||||
|
||||
/** fill the RSSI of the remote host of the bt connection and returns the last
|
||||
* time the RSSI was updated
|
||||
*
|
||||
*/
|
||||
uint32_t furi_hal_bt_get_conn_rssi(uint8_t* rssi) {
|
||||
int8_t ret_rssi = 0;
|
||||
uint32_t since = gap_get_remote_conn_rssi(&ret_rssi);
|
||||
|
||||
if(ret_rssi == 127 || since == 0) return 0;
|
||||
|
||||
*rssi = (uint8_t)abs(ret_rssi);
|
||||
|
||||
return since;
|
||||
}
|
||||
|
||||
uint32_t furi_hal_bt_get_transmitted_packets(void) {
|
||||
uint32_t packets = 0;
|
||||
aci_hal_le_tx_test_packet_number(&packets);
|
||||
|
||||
@@ -47,11 +47,7 @@
|
||||
> If for any reason this test is never passed, this means there is a failure in the system and there is no other
|
||||
> way to recover than applying a device reset.
|
||||
*/
|
||||
// Was previously 3000U, 3 seconds
|
||||
// Changing furi_assert() to furi_check() brought timeout crashes
|
||||
// Internal storage is very slow, and "big" files will often cause a "timeout" with 3 seconds
|
||||
// 10 seconds seems fine, the file operations complete successfully, albeit slowly
|
||||
#define FURI_HAL_FLASH_C2_LOCK_TIMEOUT_MS (10000U) /* 10 seconds */
|
||||
#define FURI_HAL_FLASH_C2_LOCK_TIMEOUT_MS (3000U) /* 3 seconds */
|
||||
|
||||
#define IS_ADDR_ALIGNED_64BITS(__VALUE__) (((__VALUE__) & 0x7U) == (0x00UL))
|
||||
#define IS_FLASH_PROGRAM_ADDRESS(__VALUE__) \
|
||||
|
||||
Reference in New Issue
Block a user