From 56e5041c5fb69657e4606ac120663f5d75757c67 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 27 Jan 2021 14:35:40 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20fonctionnalit=C3=A9=20de=20maintien=20d?= =?UTF-8?q?'=C3=A9tat=20au=20d=C3=A9marrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZenDrive Simulator/ZenDrive Simulator.ino | 10 +++------- ZenDrive Simulator/ZenDrive.cpp | 14 -------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/ZenDrive Simulator/ZenDrive Simulator.ino b/ZenDrive Simulator/ZenDrive Simulator.ino index 7863646..72cd394 100644 --- a/ZenDrive Simulator/ZenDrive Simulator.ino +++ b/ZenDrive Simulator/ZenDrive Simulator.ino @@ -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() { diff --git a/ZenDrive Simulator/ZenDrive.cpp b/ZenDrive Simulator/ZenDrive.cpp index ac33621..11bc97e 100644 --- a/ZenDrive Simulator/ZenDrive.cpp +++ b/ZenDrive Simulator/ZenDrive.cpp @@ -92,20 +92,6 @@ ZenDrive_::ZenDrive_() // Setup HID report structure static HIDSubDescriptor node(_hidReportDescriptor, sizeof(_hidReportDescriptor)); HID().AppendDescriptor(&node); - - // Initalize state for each module - // Gearshift module - speeds = B00000001; // (NEUTRAL;SPEED1;SPEED2;SPEED3;SPEED4;SPEED5;SPEED6;SPEEDR) - handbrake = 255; - - //Pedals module - clutch = 0; - brake = 0; - accelerator = 0; - - //Steering wheel module - wheelCommands = 0; // (BLINKER LEFT;BLINKER RIGHT;WARNING;LIGHTS;HEADLIGHTS;FOGLIGHTS;STARTER;HORN;CRUISE;CRUISE +;CRUISE -;NOT USED;NOT USED;NOT USED;NOT USED;NOT USED) - steering = 0; } void ZenDrive_::begin()