Rapid Fire: The Dubuque Protocol now uses a 100ms holdoff! (#6)
After much testing (and releasing of magic smoke), we determined that when the *Dubuque Protocol* is being employed, a holdoff of 100ms is sufficient to keep the IR LEDs alive in the 2024B "Far Horizon" barrel board. We tested with both [TSAL6100](https://www.vishay.com/en/product/81009/) and [VSLY5940](https://www.vishay.com/en/product/84240/) LEDs at 25°C ambient. Note that at the time of writing, [the 2020TPC cannot receive these tags](Software/2020TPC-SW#3). Co-authored-by: Joe Kearney <joe@clubk.club> Reviewed-on: #6
This commit is contained in:
parent
430aec54b8
commit
3892827622
1 changed files with 29 additions and 4 deletions
|
|
@ -39,6 +39,7 @@ const StateActivity_T STATE_PLAYING__INTERACTING_Activities =
|
|||
};
|
||||
|
||||
static TickType_t Time_Of_Last_Shot = 0;
|
||||
static const uint32_t DUBUQUE_PROTOCOL_HOLDOFF_in_ms = 100;
|
||||
static const uint32_t FIXED_SHOT_HOLDOFF_in_ms = 3000;
|
||||
static const uint32_t RANDOM_SHOT_HOLDOFF_in_ms = 1000;
|
||||
static TickType_t Shot_Holdoff_Time;
|
||||
|
|
@ -69,7 +70,8 @@ static void Playing__Interacting_Entry(StateMachineContext_T * context)
|
|||
* \param context Context in which this substate is being run.
|
||||
*/
|
||||
static void Playing__Interacting_Do(StateMachineContext_T * context)
|
||||
{
|
||||
{
|
||||
static Protocol_T Protocol_Of_Last_Sent_Tag = UNKNOWN_PROTOCOL;
|
||||
portBASE_TYPE xStatus;
|
||||
static KEvent_T Event;
|
||||
|
||||
|
|
@ -92,6 +94,19 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
|
|||
KEvent_T misfire_event = { .ID = KEVENT_MISFIRE, .Data = (void *)0x00 };
|
||||
Post_KEvent(&misfire_event);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t weapon_ID;
|
||||
if (SETTINGS_get_uint8_t(SYSTEMK_SETTING_WEAPONID, &weapon_ID) != SYSTEMK_RESULT_SUCCESS)
|
||||
{
|
||||
KLOG_ERROR(KLOG_TAG, "Error reading weapon ID from settings!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Weapon_t weapon = GetWeaponFromID(weapon_ID);
|
||||
Protocol_Of_Last_Sent_Tag = weapon.Protocol;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -198,9 +213,19 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
|
|||
|
||||
case KEVENT_TAG_SENT:
|
||||
{
|
||||
// "Flip ya'? Double or nuthin'!"
|
||||
uint32_t holdoff_in_ms = (rand() % 2) * RANDOM_SHOT_HOLDOFF_in_ms;
|
||||
holdoff_in_ms += FIXED_SHOT_HOLDOFF_in_ms;
|
||||
// Calculate the shot holdoff time:
|
||||
// - The Dubuque Protocol uses a very small holdoff time to protect the IR lEDs from heat damage.
|
||||
// - All the other protocols require this, plus an additional random holdoff to resolve duels.
|
||||
uint32_t holdoff_in_ms = 0;
|
||||
if (Protocol_Of_Last_Sent_Tag == DUBUQUE_PROTOCOL)
|
||||
{
|
||||
holdoff_in_ms = DUBUQUE_PROTOCOL_HOLDOFF_in_ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdoff_in_ms = (rand() % 2) * RANDOM_SHOT_HOLDOFF_in_ms;
|
||||
holdoff_in_ms += FIXED_SHOT_HOLDOFF_in_ms;
|
||||
}
|
||||
Shot_Holdoff_Time = (holdoff_in_ms / portTICK_PERIOD_MS);
|
||||
#ifdef LOG_INTERACTING_SUBSTATE
|
||||
KLOG_INFO(KLOG_TAG, "Tag sent. Holdoff: %lu ms", holdoff_in_ms);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue