fix(g29): corriger l'offset et les masques de la molette et des boutons +/-

This commit is contained in:
bleackstorm committed 2026-11-12 16:45:27 +01:00
1 parent 8006dbdcbe
commit 9294aa52de
2 files changed
+18 -11

No files matched your search

+1
View File
@@ -1,2 +1,3 @@
__pycache__/ __pycache__/
*.pyc *.pyc
build/
+17 -11
View File
@@ -23,12 +23,12 @@
#define PALETTE_PLUS_MASK 0x02 // R1 (Palette droite : Monter un rapport) #define PALETTE_PLUS_MASK 0x02 // R1 (Palette droite : Monter un rapport)
#define BOUTON_ARM_MASK 0x08 // R2 (Bascule Armé / Désarmé) #define BOUTON_ARM_MASK 0x08 // R2 (Bascule Armé / Désarmé)
// Masques additionnels dans report[7] (Molette et boutons + / - / Enter) // Masques additionnels dans report[54] (Molette et boutons + / - / Enter en mode PS4)
#define BOUTON_PLUS_MASK 0x04 // Bouton [+] (Dureté +) #define DIAL_ENTER_MASK 0x01 // Bouton central de la molette (Sauvegarde Flash)
#define DIAL_CCW_MASK 0x02 // Molette sens anti-horaire (Dureté -)
#define DIAL_CW_MASK 0x04 // Molette sens horaire (Dureté +)
#define BOUTON_MOINS_MASK 0x08 // Bouton [-] (Dureté -) #define BOUTON_MOINS_MASK 0x08 // Bouton [-] (Dureté -)
#define DIAL_CW_MASK 0x10 // Molette sens horaire (Dureté +) #define BOUTON_PLUS_MASK 0x10 // Bouton [+] (Dureté +)
#define DIAL_CCW_MASK 0x20 // Molette sens anti-horaire (Dureté -)
#define DIAL_ENTER_MASK 0x40 // Bouton central de la molette (Sauvegarde Flash)
// Armement ELRS : AUX1 = canal 5 (réservé, ne peut pas être mappé ailleurs) // Armement ELRS : AUX1 = canal 5 (réservé, ne peut pas être mappé ailleurs)
#define CANAL_ARM 5 #define CANAL_ARM 5
@@ -200,7 +200,7 @@ void afficherConfiguration() {
Serial.printf("Plage Volant(P): %d degres [P=40..900]\n", configSysteme.angleSouhaiteTotal); Serial.printf("Plage Volant(P): %d degres [P=40..900]\n", configSysteme.angleSouhaiteTotal);
Serial.printf("Expo Volant(X) : %.2f [X=0.00..0.80]\n", configSysteme.expoVolant); Serial.printf("Expo Volant(X) : %.2f [X=0.00..0.80]\n", configSysteme.expoVolant);
Serial.printf("Vibrations (T) : %d%% [T=0..100] (Mix 12Hz/60Hz + Telemetrie)\n", configSysteme.intensiteVibration); Serial.printf("Vibrations (T) : %d%% [T=0..100] (Mix 12Hz/60Hz + Telemetrie)\n", configSysteme.intensiteVibration);
Serial.println("Commandes : V=ch, A=ch, F=ch, E=ch, D=val, P=val, X=val, T=val, S(save), R(reset), ?"); Serial.println("Commandes : V=ch, A=ch, F=ch, E=ch, D=val, P=val, X=val, T=val, S(save), R(reset), B(bootsel), ?");
} }
void chargerConfiguration() { void chargerConfiguration() {
@@ -252,6 +252,12 @@ void traiterLigneSerie(char* commande) {
afficherConfiguration(); afficherConfiguration();
return; return;
} }
if (commande[0] == 'B' || commande[0] == 'b') {
Serial.println(">> Redemarrage en mode BOOTSEL...");
Serial.flush();
rp2040.rebootToBootloader();
return;
}
if (commande[0] == 'S' || commande[0] == 's') { if (commande[0] == 'S' || commande[0] == 's') {
sauvegarderConfiguration(); sauvegarderConfiguration();
return; return;
@@ -909,7 +915,7 @@ void __not_in_flash_func(tuh_hid_report_received_cb)(uint8_t dev_addr, uint8_t i
if (dev_addr != g29_dev_addr || instance != g29_instance) { if (dev_addr != g29_dev_addr || instance != g29_instance) {
return; // Ne pas réarmer la réception d'un périphérique étranger return; // Ne pas réarmer la réception d'un périphérique étranger
} }
if (len < 51 || report[0] != G29_REPORT_ID) { if (len < 55 || report[0] != G29_REPORT_ID) {
compteurRapportsRejetes++; compteurRapportsRejetes++;
tuh_hid_receive_report(dev_addr, instance); tuh_hid_receive_report(dev_addr, instance);
return; return;
@@ -990,10 +996,10 @@ void __not_in_flash_func(tuh_hid_report_received_cb)(uint8_t dev_addr, uint8_t i
} }
// Réglage de la dureté du volant à la volée via la molette ou boutons [+] / [-] // Réglage de la dureté du volant à la volée via la molette ou boutons [+] / [-]
uint8_t b7 = (len > 7) ? report[7] : 0; uint8_t b54 = (len > 54) ? report[54] : 0;
bool dialPlusActuel = (b7 & DIAL_CW_MASK) || (b7 & BOUTON_PLUS_MASK); bool dialPlusActuel = (b54 & DIAL_CW_MASK) || (b54 & BOUTON_PLUS_MASK);
bool dialMoinsActuel = (b7 & DIAL_CCW_MASK) || (b7 & BOUTON_MOINS_MASK); bool dialMoinsActuel = (b54 & DIAL_CCW_MASK) || (b54 & BOUTON_MOINS_MASK);
bool dialEnterActuel = (b7 & DIAL_ENTER_MASK); bool dialEnterActuel = (b54 & DIAL_ENTER_MASK);
if (dialPlusActuel && !dialPlusDejaEnfonce) { if (dialPlusActuel && !dialPlusDejaEnfonce) {
if (configSysteme.forceRessort <= 245) configSysteme.forceRessort += 10; if (configSysteme.forceRessort <= 245) configSysteme.forceRessort += 10;