mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
feat(g29): corriger le protocole des leds rpm avec le report id 0x30
This commit is contained in:
1 parent
0e4667b8eb
commit
abd5214863
6 files changed
+571
-46
No files matched your search
+16
-46
@@ -379,12 +379,12 @@ void loop() {
|
||||
// =========================================================================
|
||||
// CŒUR 1 : PILE PIO-USB, AUTO-CENTER ET LEDS G29
|
||||
// =========================================================================
|
||||
bool envoyerTrameG29_F3_Simple(const uint8_t cmd7[7]) {
|
||||
bool envoyerTrameG29_0x30(const uint8_t cmd7[7]) {
|
||||
if (!tuh_hid_send_ready(g29_dev_addr, g29_instance)) return false;
|
||||
static uint8_t payload63[63];
|
||||
memset(payload63, 0, sizeof(payload63));
|
||||
memcpy(payload63, cmd7, 7);
|
||||
return tuh_hid_send_report(g29_dev_addr, g29_instance, 0xF3, payload63, 63);
|
||||
return tuh_hid_send_report(g29_dev_addr, g29_instance, 0x30, payload63, sizeof(payload63));
|
||||
}
|
||||
|
||||
void gererInitMoteurG29() {
|
||||
@@ -393,13 +393,13 @@ void gererInitMoteurG29() {
|
||||
|
||||
uint16_t angle = (uint16_t)ANGLE_SOUHAITE_TOTAL;
|
||||
const uint8_t cmdRange[7] = {0xF8, 0x81, (uint8_t)(angle & 0xFF), (uint8_t)(angle >> 8), 0x00, 0x00, 0x00};
|
||||
const uint8_t cmdSpring[7] = {0xFE, 0x0D, PENTE_RESSORT_G29 & 0x07, PENTE_RESSORT_G29 & 0x07, FORCE_RESSORT_G29, 0x00, 0x00};
|
||||
const uint8_t cmdSpring[7] = {0xFE, 0x0D, (uint8_t)(PENTE_RESSORT_G29 & 0x07), (uint8_t)(PENTE_RESSORT_G29 & 0x07), (uint8_t)FORCE_RESSORT_G29, 0x00, 0x00};
|
||||
const uint8_t cmdEnable[7] = {0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
switch (etapeInitMoteur) {
|
||||
case 0: if (envoyerTrameG29_F3_Simple(cmdRange)) etapeInitMoteur++; break;
|
||||
case 1: if (envoyerTrameG29_F3_Simple(cmdSpring)) etapeInitMoteur++; break;
|
||||
case 2: if (envoyerTrameG29_F3_Simple(cmdEnable)) etapeInitMoteur++; break;
|
||||
case 0: if (envoyerTrameG29_0x30(cmdRange)) etapeInitMoteur++; break;
|
||||
case 1: if (envoyerTrameG29_0x30(cmdSpring)) etapeInitMoteur++; break;
|
||||
case 2: if (envoyerTrameG29_0x30(cmdEnable)) etapeInitMoteur++; break;
|
||||
case 3: etapeInitMoteur = 6; break;
|
||||
}
|
||||
}
|
||||
@@ -413,50 +413,20 @@ void envoyerLedsG29(uint8_t masque5bits) {
|
||||
etapeEnvoiLed = 1;
|
||||
}
|
||||
if (etapeEnvoiLed == 0 || !tuh_hid_send_ready(g29_dev_addr, g29_instance)) return;
|
||||
|
||||
uint8_t m = dernierMasqueLedG29 & 0x1F;
|
||||
|
||||
// Format validé sur G29 PS4 physique :
|
||||
// Report ID = 0x30, payload 63 octets débutant par F8 12 <masque> suivi de zéros
|
||||
static uint8_t payload63[63];
|
||||
for (int i = 0; i < 63; i += 7) {
|
||||
payload63[i + 0] = 0xF8;
|
||||
payload63[i + 1] = 0x12;
|
||||
payload63[i + 2] = m;
|
||||
payload63[i + 3] = 0x00;
|
||||
payload63[i + 4] = 0x00;
|
||||
payload63[i + 5] = 0x00;
|
||||
payload63[i + 6] = 0x00;
|
||||
}
|
||||
memset(payload63, 0, sizeof(payload63));
|
||||
payload63[0] = 0xF8;
|
||||
payload63[1] = 0x12;
|
||||
payload63[2] = m;
|
||||
|
||||
if (etapeEnvoiLed == 1) {
|
||||
if (tuh_hid_send_report(g29_dev_addr, g29_instance, 0xF3, payload63, 63)) {
|
||||
statutEnvoiLed = 1;
|
||||
etapeEnvoiLed = 2;
|
||||
}
|
||||
}
|
||||
else if (etapeEnvoiLed == 2) {
|
||||
if (tuh_hid_send_report(g29_dev_addr, g29_instance, 0x30, payload63, 63)) {
|
||||
statutEnvoiLed = 2;
|
||||
etapeEnvoiLed = 3;
|
||||
}
|
||||
}
|
||||
else if (etapeEnvoiLed == 3) {
|
||||
if (tuh_hid_send_report(g29_dev_addr, g29_instance, 0x05, payload63, 31)) {
|
||||
statutEnvoiLed = 3;
|
||||
etapeEnvoiLed = 4;
|
||||
}
|
||||
}
|
||||
else if (etapeEnvoiLed == 4) {
|
||||
static uint8_t payloadDecale[63];
|
||||
memset(payloadDecale, 0, sizeof(payloadDecale));
|
||||
payloadDecale[0] = 0x00;
|
||||
for (int i = 1; i + 7 <= 63; i += 7) {
|
||||
payloadDecale[i + 0] = 0xF8;
|
||||
payloadDecale[i + 1] = 0x12;
|
||||
payloadDecale[i + 2] = m;
|
||||
}
|
||||
if (tuh_hid_send_report(g29_dev_addr, g29_instance, 0xF3, payloadDecale, 63)) {
|
||||
statutEnvoiLed = 4;
|
||||
etapeEnvoiLed = 0;
|
||||
}
|
||||
if (tuh_hid_send_report(g29_dev_addr, g29_instance, 0x30, payload63, sizeof(payload63))) {
|
||||
statutEnvoiLed = 1;
|
||||
etapeEnvoiLed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user