Correctifs de bugs

This commit is contained in:
=
2021-01-27 14:19:36 +01:00
parent 561a727a0a
commit 058362a533
6 changed files with 105 additions and 63 deletions

View File

@@ -25,7 +25,7 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x85, GEARSHIFT_REPORT_ID, // REPORT_ID (3)
0x85, 0x03, // REPORT_ID (3)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x08, // USAGE_MAXIMUM (Button 8)
@@ -47,7 +47,7 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x85, PEDALS_REPORT_ID, // REPORT_ID (4)
0x85, 0x04, // REPORT_ID (4)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
@@ -63,10 +63,10 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x85, WHEEL_REPORT_ID, // REPORT_ID (5)
0x85, 0x05, // REPORT_ID (5)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x0b, // USAGE_MAXIMUM (Button 11)
0x19, 0x09, // USAGE_MINIMUM (Button 9)
0x29, 0x13, // USAGE_MAXIMUM (Button 19)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
@@ -76,15 +76,15 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
0x75, 0x05, // REPORT_SIZE (5)
0x81, 0x03, // INPUT (Cnst,Var,Abs)
0x05, 0x02, // USAGE_PAGE (Simulation Controls)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7f, // LOGICAL_MAXIMUM (127)
0xa1, 0x00, // COLLECTION (Physical)
0x09, 0xc8, // USAGE (Steering)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
0xc0 // END_COLLECTION
};
ZenDrive_::ZenDrive_()
@@ -108,7 +108,7 @@ ZenDrive_::ZenDrive_()
steering = 0;
}
void ZenDrive_::begin(bool initAutoSendState)
void ZenDrive_::begin()
{
// Sending initial states
sendGearshiftStates();
@@ -293,6 +293,7 @@ void ZenDrive_::setBlinkerLeft(bool value)
{
bitSet(wheelCommands, 0);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 0);
sendWheelStates();
isBlinkerLeft = !isBlinkerLeft;
@@ -305,6 +306,7 @@ void ZenDrive_::setBlinkerRight(bool value)
{
bitSet(wheelCommands, 1);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 1);
sendWheelStates();
isBlinkerRight = !isBlinkerRight;
@@ -317,6 +319,7 @@ void ZenDrive_::setWarning(bool value)
{
bitSet(wheelCommands, 2);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 2);
sendWheelStates();
isWarning = !isWarning;
@@ -332,8 +335,10 @@ void ZenDrive_::switchLightsOn()
for(int i = 0; i < steps; i++){
bitSet(wheelCommands, 3);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 3);
sendWheelStates();
delay(50);
isLights = true;
isRoadLights = false;
}
@@ -349,8 +354,10 @@ void ZenDrive_::switchRoadLights()
for(int i = 0; i < steps; i++){
bitSet(wheelCommands, 3);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 3);
sendWheelStates();
delay(50);
isLights = false;
isRoadLights = true;
}
@@ -366,8 +373,10 @@ void ZenDrive_::switchLightsOff()
for(int i = 0; i < steps; i++){
bitSet(wheelCommands, 3);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 3);
sendWheelStates();
delay(50);
isLights = false;
isRoadLights = false;
}
@@ -380,6 +389,7 @@ void ZenDrive_::setHeadLights(bool value)
{
bitSet(wheelCommands, 4);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 4);
sendWheelStates();
isHeadLights = !isHeadLights;
@@ -392,6 +402,7 @@ void ZenDrive_::setFogLights(bool value)
{
bitSet(wheelCommands, 5);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 5);
sendWheelStates();
isFogLights = !isFogLights;
@@ -404,6 +415,7 @@ void ZenDrive_::setStarter(bool value)
{
bitSet(wheelCommands, 6);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 6);
sendWheelStates();
isStarter = !isStarter;
@@ -416,6 +428,7 @@ void ZenDrive_::setHorn(bool value)
{
if(value) bitSet(wheelCommands, 7);
else bitClear(wheelCommands, 7);
isHorn = !isHorn;
wheelNeedRefresh = true;
}
}
@@ -424,24 +437,30 @@ void ZenDrive_::activeCruise()
{
bitSet(wheelCommands, 8);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 8);
sendWheelStates();
wheelNeedRefresh = false;
}
void ZenDrive_::increaseCruise()
{
bitSet(wheelCommands, 9);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 9);
sendWheelStates();
wheelNeedRefresh = false;
}
void ZenDrive_::decreaseCruise()
{
bitSet(wheelCommands, 10);
sendWheelStates();
delay(50);
bitClear(wheelCommands, 10);
sendWheelStates();
wheelNeedRefresh = false;
}
void ZenDrive_::setDirection(uint8_t value)