Skip to content

Commit 1a5d5ea

Browse files
committed
Add a ton of new event triggers
1 parent d4dad48 commit 1a5d5ea

File tree

4 files changed

+178
-3
lines changed

4 files changed

+178
-3
lines changed

src/main/lightController/integrations/rgbToColorTemp.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ export function rgbToColorTemp(
2626
return (minMiReds + maxMiReds) / 2;
2727
case EventType.SessionEnded:
2828
return 0;
29+
default:
30+
return 0;
2931
}
3032
}

src/main/multiviewer/api.ts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ function checkForNewEventsInRaceControlMessages(
210210
) {
211211
if (!RaceControlMessages || !RaceControlMessages.Messages) return;
212212

213+
if (
214+
processedRaceControlMessages.Messages.length === 0 &&
215+
RaceControlMessages.Messages.length > 0
216+
) {
217+
processedRaceControlMessages = RaceControlMessages;
218+
return;
219+
}
220+
213221
if (
214222
RaceControlMessages.Messages.length ===
215223
processedRaceControlMessages.Messages.length
@@ -250,6 +258,119 @@ function checkForNewEventsInRaceControlMessages(
250258
if (lastMessage.SubCategory === RaceControlMessageSubCategory.TimePenalty) {
251259
newEventHandler(EventType.TimePenalty);
252260
}
261+
if (
262+
lastMessage.SubCategory ===
263+
RaceControlMessageSubCategory.SessionStartDelayed
264+
) {
265+
newEventHandler(EventType.SessionStartDelayed);
266+
}
267+
if (
268+
lastMessage.SubCategory ===
269+
RaceControlMessageSubCategory.SessionDurationChanged
270+
) {
271+
newEventHandler(EventType.SessionDurationChanged);
272+
}
273+
if (
274+
lastMessage.SubCategory === RaceControlMessageSubCategory.LapTimeDeleted
275+
) {
276+
newEventHandler(EventType.LapTimeDeleted);
277+
}
278+
if (
279+
lastMessage.SubCategory === RaceControlMessageSubCategory.LapTimeReinstated
280+
) {
281+
newEventHandler(EventType.LapTimeReinstated);
282+
}
283+
if (
284+
lastMessage.SubCategory ===
285+
RaceControlMessageSubCategory.LappedCarsMayOvertake
286+
) {
287+
newEventHandler(EventType.LappedCarsMayOvertake);
288+
}
289+
if (
290+
lastMessage.SubCategory ===
291+
RaceControlMessageSubCategory.LappedCarsMayNotOvertake
292+
) {
293+
newEventHandler(EventType.LappedCarsMayNotOvertake);
294+
}
295+
if (
296+
lastMessage.SubCategory ===
297+
RaceControlMessageSubCategory.NormalGripConditions
298+
) {
299+
newEventHandler(EventType.NormalGripConditions);
300+
}
301+
if (
302+
lastMessage.SubCategory ===
303+
RaceControlMessageSubCategory.OffTrackAndContinued
304+
) {
305+
newEventHandler(EventType.OffTrackAndContinued);
306+
}
307+
if (
308+
lastMessage.SubCategory === RaceControlMessageSubCategory.SpunAndContinued
309+
) {
310+
newEventHandler(EventType.SpunAndContinued);
311+
}
312+
if (lastMessage.SubCategory === RaceControlMessageSubCategory.MissedApex) {
313+
newEventHandler(EventType.MissedApex);
314+
}
315+
if (lastMessage.SubCategory === RaceControlMessageSubCategory.CarStopped) {
316+
newEventHandler(EventType.CarStopped);
317+
}
318+
if (lastMessage.SubCategory === RaceControlMessageSubCategory.MedicalCar) {
319+
newEventHandler(EventType.MedicalCar);
320+
}
321+
if (lastMessage.SubCategory === RaceControlMessageSubCategory.IncidentNoted) {
322+
newEventHandler(EventType.IncidentNoted);
323+
}
324+
if (
325+
lastMessage.SubCategory ===
326+
RaceControlMessageSubCategory.IncidentUnderInvestigation
327+
) {
328+
newEventHandler(EventType.IncidentUnderInvestigation);
329+
}
330+
if (
331+
lastMessage.SubCategory ===
332+
RaceControlMessageSubCategory.IncidentInvestigationAfterSession
333+
) {
334+
newEventHandler(EventType.IncidentInvestigationAfterSession);
335+
}
336+
if (
337+
lastMessage.SubCategory ===
338+
RaceControlMessageSubCategory.IncidentNoFurtherAction
339+
) {
340+
newEventHandler(EventType.IncidentNoFurtherAction);
341+
}
342+
if (
343+
lastMessage.SubCategory ===
344+
RaceControlMessageSubCategory.IncidentNoFurtherInvestigation
345+
) {
346+
newEventHandler(EventType.IncidentNoFurtherInvestigation);
347+
}
348+
if (lastMessage.SubCategory === RaceControlMessageSubCategory.StopGoPenalty) {
349+
newEventHandler(EventType.StopGoPenalty);
350+
}
351+
if (
352+
lastMessage.SubCategory ===
353+
RaceControlMessageSubCategory.TrackSurfaceSlippery
354+
) {
355+
newEventHandler(EventType.TrackSurfaceSlippery);
356+
}
357+
if (
358+
lastMessage.SubCategory === RaceControlMessageSubCategory.LowGripConditions
359+
) {
360+
newEventHandler(EventType.LowGripConditions);
361+
}
362+
if (
363+
lastMessage.SubCategory ===
364+
RaceControlMessageSubCategory.SessionStartAborted
365+
) {
366+
newEventHandler(EventType.SessionStartAborted);
367+
}
368+
if (
369+
lastMessage.SubCategory ===
370+
RaceControlMessageSubCategory.DriveThroughPenalty
371+
) {
372+
newEventHandler(EventType.DriveThroughPenalty);
373+
}
253374

254375
processedRaceControlMessages = RaceControlMessages;
255376
}

src/shared/config/config_types.ts

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const eventTypeReadableMap = {
1+
export const eventTypeReadableMap: Record<EventType, string> = {
22
GreenFlag: "Green Flag",
33
YellowFlag: "Yellow Flag",
44
RedFlag: "Red Flag",
@@ -15,6 +15,28 @@ export const eventTypeReadableMap = {
1515
PitExitOpen: "Pit Exit Open",
1616
PitEntryClosed: "Pit Entry Closed",
1717
TimePenalty: "Time Penalty",
18+
SessionStartDelayed: "Session Start Delayed",
19+
SessionDurationChanged: "Session Duration Changed",
20+
LapTimeDeleted: "Lap Time Deleted",
21+
LapTimeReinstated: "Lap Time Reinstated",
22+
LappedCarsMayOvertake: "Lapped Cars May Overtake",
23+
LappedCarsMayNotOvertake: "Lapped Cars May Not Overtake",
24+
NormalGripConditions: "Normal Grip Conditions",
25+
OffTrackAndContinued: "Off Track And Continued",
26+
SpunAndContinued: "Spun And Continued",
27+
MissedApex: "Missed Apex",
28+
CarStopped: "Car Stopped",
29+
MedicalCar: "Medical Car",
30+
IncidentNoted: "Incident Noted",
31+
IncidentUnderInvestigation: "Incident Under Investigation",
32+
IncidentInvestigationAfterSession: "Incident Investigation After Session",
33+
IncidentNoFurtherAction: "Incident No Further Action",
34+
IncidentNoFurtherInvestigation: "Incident No Further Investigation",
35+
StopGoPenalty: "Stop Go Penalty",
36+
TrackSurfaceSlippery: "Track Surface Slippery",
37+
LowGripConditions: "Low Grip Conditions",
38+
SessionStartAborted: "Session Start Aborted",
39+
DriveThroughPenalty: "Drive Through Penalty",
1840
};
1941

2042
export enum EventType {
@@ -34,9 +56,31 @@ export enum EventType {
3456
PitExitOpen = "PitExitOpen",
3557
PitEntryClosed = "PitEntryClosed",
3658
TimePenalty = "TimePenalty",
59+
SessionStartDelayed = "SessionStartDelayed",
60+
SessionDurationChanged = "SessionDurationChanged",
61+
LapTimeDeleted = "LapTimeDeleted",
62+
LapTimeReinstated = "LapTimeReinstated",
63+
LappedCarsMayOvertake = "LappedCarsMayOvertake",
64+
LappedCarsMayNotOvertake = "LappedCarsMayNotOvertake",
65+
NormalGripConditions = "NormalGripConditions",
66+
OffTrackAndContinued = "OffTrackAndContinued",
67+
SpunAndContinued = "SpunAndContinued",
68+
MissedApex = "MissedApex",
69+
CarStopped = "CarStopped",
70+
MedicalCar = "MedicalCar",
71+
IncidentNoted = "IncidentNoted",
72+
IncidentUnderInvestigation = "IncidentUnderInvestigation",
73+
IncidentInvestigationAfterSession = "IncidentInvestigationAfterSession",
74+
IncidentNoFurtherAction = "IncidentNoFurtherAction",
75+
IncidentNoFurtherInvestigation = "IncidentNoFurtherInvestigation",
76+
StopGoPenalty = "StopGoPenalty",
77+
TrackSurfaceSlippery = "TrackSurfaceSlippery",
78+
LowGripConditions = "LowGripConditions",
79+
SessionStartAborted = "SessionStartAborted",
80+
DriveThroughPenalty = "DriveThroughPenalty",
3781
}
3882

39-
export const actionTypeReadableMap = {
83+
export const actionTypeReadableMap: Record<ActionType, string> = {
4084
On: "On",
4185
Off: "Off",
4286
Delay: "Delay",

src/shared/multiviewer/graphql_api_types.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface IRealtimeTimingState {
1111
Heartbeat: IHeartbeat;
1212
LapCount: ILapCount | undefined;
1313
LapSeries: ILapSeries | undefined;
14-
LapTimeSeries: any;
14+
LapTimeSeries: ILapTimeSeries | undefined;
1515
PitLaneTimeCollection: IPitLaneTimeCollection | undefined;
1616
Position: IPosition;
1717
RaceControlMessages: IRaceControlMessages;
@@ -237,6 +237,14 @@ export enum RaceControlMessageSubCategory {
237237
SessionResume = "SessionResume",
238238
Correction = "Correction",
239239
RecoveryVehicle = "RecoveryVehicle",
240+
SessionTemperatures = "SessionTemperatures",
241+
PaddingMaterial = "PaddingMaterial",
242+
AwningsAllowed = "AwningsAllowed",
243+
MandatoryTireCompound = "MandatoryTireCompound",
244+
RestartOrder = "RestartOrder",
245+
NoPracticeStarts = "NoPracticeStarts",
246+
SessionStartAborted = "SessionStartAborted",
247+
DriveThroughPenalty = "DriveThroughPenalty",
240248
}
241249

242250
export interface IRaceControlMessage {

0 commit comments

Comments
 (0)