Skip to content

Commit 5515333

Browse files
committed
Zeroize CState from Setup1 to avoid possible data race
1 parent c8cdf54 commit 5515333

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

firmware.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ void loop() {
2222
}
2323

2424
void setup1() {
25+
ZeroizeCState();
2526
WireSetup(GIZMO_HW_I2C_SDA, GIZMO_HW_I2C_SCL);
2627
}
2728

gizmo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ bool loadConfig(String);
7979
void loadConfigFromSerial();
8080
void checkIfShouldConfig();
8181
void checkBatteryArchitecture();
82-
void zeroizeCState();
82+
void ZeroizeCState();
8383

8484
bool netLinkOk();
8585
void netLinkResetWiznet();
@@ -126,7 +126,7 @@ void ConfigureWiznetReset(byte rst) {
126126
}
127127

128128

129-
void zeroizeCState() {
129+
void ZeroizeCState() {
130130
cstate.Button0 = false;
131131
cstate.Button1 = false;
132132
cstate.Button2 = false;
@@ -152,7 +152,7 @@ void GizmoSetup() {
152152
// Ensure that the cstate values for axis data start at a reasonable
153153
// zero point. This prevents machines from running off into the
154154
// wild blue yonder.
155-
zeroizeCState();
155+
ZeroizeCState();
156156

157157
delay(3000);
158158

@@ -554,7 +554,7 @@ void netStateRun() {
554554

555555
if (nextControlPacketDueBy < millis()) {
556556
status.SetControlConnected(false);
557-
zeroizeCState();
557+
ZeroizeCState();
558558
return;
559559
}
560560

gizmo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ enum NetLink {
7474
NET_WIRELESS,
7575
};
7676

77+
void ZeroizeCState();
7778
void ConfigureTeamNumber(int);
7879
void ConfigureStatusIO(byte, byte, byte, byte, byte, byte, byte, byte);
7980
void ConfigureBoardVoltageTuning(float, float);

0 commit comments

Comments
 (0)