Merge remote-tracking branch 'refs/remotes/origin/New_BLE'

This commit is contained in:
Joe Kearney 2025-06-05 20:11:24 -05:00
commit 257f0b7cde
4 changed files with 15 additions and 3 deletions

View file

@ -25,5 +25,6 @@
SystemKResult_T BLE_GetMyAddress(uint8_t * BD_ADDR);
SystemKResult_T BLE_ScanAndAdvertise(void);
SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T * data);
SystemKResult_T BLE_StopAdvertising(void);
#endif // BLE_HW_INTERFACE_H

View file

@ -305,6 +305,11 @@ void BLE_RespondToConfigurationPacket(const BLE_ParametersPacket_T *const packet
{
KLOG_ERROR(KLOG_TAG, "Error responding to configuration packet!");
}
if (BLE_ScanAndAdvertise() != SYSTEMK_RESULT_SUCCESS)
{
KLOG_ERROR(KLOG_TAG, "Couldn't scan and advertise!");
}
}
void BLE_BroadcastCurrentParameterInfoPacket(const BLE_ParameterKey_T key_one, const uint32_t value_one, const BLE_ParameterKey_T key_two, const uint32_t value_two)

View file

@ -158,7 +158,7 @@ Weapon_t WeaponsByID[NUMBER_OF_WEAPONS] =
// The Dubuque Protocol
{
.ID = LASER_X_ID,
.ID = DUBUQUE_PROTOCOL_ID,
.Type = ENERGY,
.Protocol = DUBUQUE_PROTOCOL,
.Damage_Per_Shot = 1,

View file

@ -34,7 +34,8 @@ static TickType_t xBLEConfigurationResponseTimerPeriod = 3000 / portTICK_PERIOD_
static void BLEConfigurationResponseTimerCallback(TimerHandle_t xTimer)
{
BLE_UpdateHelloPacket();
// Don't send HELLO packets once configuration has started.
BLE_StopAdvertising();
}
#define MAX_MENU_DEPTH 10
@ -107,7 +108,7 @@ static void Configuring_Do(StateMachineContext_T *context)
portBASE_TYPE xStatus;
static KEvent_T Event;
// For the first hunderd milliseconds, keep updating the Hello packet, since on some platforms (PSoC6), one call is not enough.
// For the first hundred milliseconds, keep updating the Hello packet, since on some platforms (PSoC6), one call is not enough.
// TODO: Fix the Hello packet hack on PSoC6.
if ((xTaskGetTickCount() - context->Time_At_State_Entry_In_Ticks) < (100 / portTICK_PERIOD_MS))
{
@ -414,6 +415,11 @@ void HandleBLEConfigurationPacket(const BLE_ParametersPacket_T *const packet)
}
}
}
else
{
// Once configuration has begun, stop advertising the HELLO packet to free up bandwidth.
BLE_StopAdvertising();
}
BLE_FreePacketBuffer((BLE_GenericPacketType_T *)packet);
}