Ajout fonctionnalité de maintien d'état au démarrage

This commit is contained in:
=
2021-01-27 14:35:40 +01:00
parent 562a43a6dd
commit 56e5041c5f
2 changed files with 3 additions and 21 deletions

View File

@@ -53,10 +53,7 @@ void setup() {
pinMode(HEAD_LIGHTS_PIN, INPUT_PULLUP);
pinMode(FOG_LIGHTS_PIN, INPUT_PULLUP);
// Initialize ZenDrive Library
ZenDrive.begin();
// Send current states
// Set current states
/* Gearshift */
if(USE_GEARSHIFT){
int value = analogRead(SPEEDS_PIN);
@@ -70,7 +67,6 @@ void setup() {
else ZenDrive.switchNeutral();
//Read handbrake
ZenDrive.setHandbrake(map(analogRead(HANDBRAKE_PIN), 0, 1023, 0, 255));
ZenDrive.sendGearshiftStates();
}
/* Pedals module */
if(USE_PEDALS){
@@ -80,7 +76,6 @@ void setup() {
ZenDrive.setBrake(map(analogRead(BRAKE_PIN), 0, 1023, 0, 255));
// Read accelerator
ZenDrive.setAccelerator(map(analogRead(ACCELERATOR_PIN), 0, 1023, 0, 255));
ZenDrive.sendPedalsStates();
}
/* Steering wheel module */
if(USE_WHEEL){
@@ -113,8 +108,9 @@ void setup() {
ZenDrive.setStarter(digitalRead(STARTER_PIN));
// Read direction
ZenDrive.setDirection(map(analogRead(DIRECTION_PIN), 0, 1023, -127, 127));
ZenDrive.sendWheelStates();
}
// Initialize ZenDrive Library
ZenDrive.begin();
}
void loop() {