mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
Merge pull request #4 from bleackstorm/fix/g29-autocenter-range-lock
fix(g29): corriger le verrouillage de plage angulaire et le recentrag…
This commit is contained in:
4 files changed
+129
-9
No files matched your search
+4
-7
@@ -106,9 +106,9 @@ volatile bool logRejetRequis = false;
|
|||||||
volatile uint16_t rejet_vid = 0;
|
volatile uint16_t rejet_vid = 0;
|
||||||
volatile uint16_t rejet_pid = 0;
|
volatile uint16_t rejet_pid = 0;
|
||||||
|
|
||||||
uint8_t dernierMasqueLedG29 = 0xFF;
|
volatile uint8_t dernierMasqueLedG29 = 0xFF;
|
||||||
uint8_t etapeEnvoiLed = 0;
|
volatile uint8_t etapeEnvoiLed = 0;
|
||||||
uint8_t etapeInitMoteur = 0;
|
volatile uint8_t etapeInitMoteur = 0;
|
||||||
|
|
||||||
char serialBuffer[32];
|
char serialBuffer[32];
|
||||||
uint8_t serialBufferIdx = 0;
|
uint8_t serialBufferIdx = 0;
|
||||||
@@ -394,13 +394,10 @@ void gererInitMoteurG29() {
|
|||||||
uint16_t angle = (uint16_t)ANGLE_SOUHAITE_TOTAL;
|
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 cmdRange[7] = {0xF8, 0x81, (uint8_t)(angle & 0xFF), (uint8_t)(angle >> 8), 0x00, 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 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) {
|
switch (etapeInitMoteur) {
|
||||||
case 0: if (envoyerTrameG29_0x30(cmdRange)) etapeInitMoteur++; break;
|
case 0: if (envoyerTrameG29_0x30(cmdRange)) etapeInitMoteur++; break;
|
||||||
case 1: if (envoyerTrameG29_0x30(cmdSpring)) etapeInitMoteur++; break;
|
case 1: if (envoyerTrameG29_0x30(cmdSpring)) etapeInitMoteur = 6; break;
|
||||||
case 2: if (envoyerTrameG29_0x30(cmdEnable)) etapeInitMoteur++; break;
|
|
||||||
case 3: etapeInitMoteur = 6; break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -5,11 +5,24 @@ Isolate the exact LED command on G29
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import glob
|
||||||
import time
|
import time
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
||||||
HIDIOCSFEATURE = lambda length: 0xC0004806 | (length << 16)
|
HIDIOCSFEATURE = lambda length: 0xC0004806 | (length << 16)
|
||||||
dev = '/dev/hidraw2'
|
|
||||||
|
def find_g29():
|
||||||
|
for h in sorted(glob.glob('/dev/hidraw*')):
|
||||||
|
uevent = f'/sys/class/hidraw/{os.path.basename(h)}/device/uevent'
|
||||||
|
if os.path.exists(uevent):
|
||||||
|
try:
|
||||||
|
with open(uevent) as f:
|
||||||
|
c = f.read().upper()
|
||||||
|
if '046D:0000C260' in c or '046D:0000C24F' in c or 'LOGITECH' in c:
|
||||||
|
return h
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return '/dev/hidraw2'
|
||||||
|
|
||||||
def make_cmd(mask):
|
def make_cmd(mask):
|
||||||
return bytes([0xF8, 0x12, mask, 0x00, 0x00, 0x00, 0x00])
|
return bytes([0xF8, 0x12, mask, 0x00, 0x00, 0x00, 0x00])
|
||||||
@@ -58,6 +71,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
name, func = candidates[cid]
|
name, func = candidates[cid]
|
||||||
print(f"Test de {name} -> Action: {action}")
|
print(f"Test de {name} -> Action: {action}")
|
||||||
|
dev = find_g29()
|
||||||
fd = os.open(dev, os.O_RDWR)
|
fd = os.open(dev, os.O_RDWR)
|
||||||
|
|
||||||
if action == 'off':
|
if action == 'off':
|
||||||
|
|||||||
+15
-1
@@ -6,13 +6,27 @@ Tests both FFB (force/spring) and LEDs to find which channel the G29 responds to
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import glob
|
||||||
import time
|
import time
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
||||||
HIDIOCSFEATURE = lambda length: 0xC0004806 | (length << 16)
|
HIDIOCSFEATURE = lambda length: 0xC0004806 | (length << 16)
|
||||||
|
|
||||||
|
def find_g29():
|
||||||
|
for h in sorted(glob.glob('/dev/hidraw*')):
|
||||||
|
uevent = f'/sys/class/hidraw/{os.path.basename(h)}/device/uevent'
|
||||||
|
if os.path.exists(uevent):
|
||||||
|
try:
|
||||||
|
with open(uevent) as f:
|
||||||
|
c = f.read().upper()
|
||||||
|
if '046D:0000C260' in c or '046D:0000C24F' in c or 'LOGITECH' in c:
|
||||||
|
return h
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return '/dev/hidraw2'
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
dev = '/dev/hidraw2'
|
dev = find_g29()
|
||||||
print(f"=== TEST DIAGNOSTIC G29 PS4 SUR {dev} ===")
|
print(f"=== TEST DIAGNOSTIC G29 PS4 SUR {dev} ===")
|
||||||
fd = os.open(dev, os.O_RDWR)
|
fd = os.open(dev, os.O_RDWR)
|
||||||
|
|
||||||
|
|||||||
Executable
+95
@@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Test interactif de Force Feedback / Recentrage (Spring) et Butée (Range) pour Logitech G29
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import glob
|
||||||
|
import time
|
||||||
|
|
||||||
|
def find_g29():
|
||||||
|
for h in sorted(glob.glob('/dev/hidraw*')):
|
||||||
|
uevent = f'/sys/class/hidraw/{os.path.basename(h)}/device/uevent'
|
||||||
|
if os.path.exists(uevent):
|
||||||
|
try:
|
||||||
|
with open(uevent) as f:
|
||||||
|
c = f.read().upper()
|
||||||
|
if '046D:0000C260' in c or '046D:0000C24F' in c or 'LOGITECH' in c:
|
||||||
|
return h
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return '/dev/hidraw2'
|
||||||
|
|
||||||
|
CMD_RANGE_180 = bytes([0xF8, 0x81, 0xB4, 0x00, 0x00, 0x00, 0x00]) # 180 deg
|
||||||
|
CMD_RANGE_900 = bytes([0xF8, 0x81, 0x84, 0x03, 0x00, 0x00, 0x00]) # 900 deg
|
||||||
|
CMD_SPRING_140 = bytes([0xFE, 0x0D, 0x07, 0x07, 140, 0x00, 0x00]) # Force 140
|
||||||
|
CMD_SPRING_MAX = bytes([0xFE, 0x0D, 0x07, 0x07, 0xFF, 0x00, 0x00]) # Force 255
|
||||||
|
CMD_SPRING_OFF = bytes([0xFE, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00]) # Force 0
|
||||||
|
CMD_ENABLE_14 = bytes([0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) # 0x14 (Autocenter default)
|
||||||
|
CMD_DISABLE_F5 = bytes([0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) # 0xF5 (Deactivate default autocenter)
|
||||||
|
|
||||||
|
def send_r30(fd, cmd7):
|
||||||
|
payload = bytes([0x30]) + cmd7 + bytes([0x00] * 56)
|
||||||
|
return os.write(fd, payload)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
dev = find_g29()
|
||||||
|
print(f"=== TEST RECENTRAGE + BUTÉE 180° G29 SUR {dev} ===")
|
||||||
|
|
||||||
|
try:
|
||||||
|
fd = os.open(dev, os.O_RDWR)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Erreur d'ouverture {dev} : {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
tests = {
|
||||||
|
"A": ("Range 180° + Spring 140 SANS commande 0x14 (Recommandé)", [
|
||||||
|
("Range 180°", CMD_RANGE_180),
|
||||||
|
("Spring 140", CMD_SPRING_140),
|
||||||
|
]),
|
||||||
|
"B": ("Ordre inverse : 0x14 d'abord, PUIS Range 180°, PUIS Spring 140", [
|
||||||
|
("Enable 0x14", CMD_ENABLE_14),
|
||||||
|
("Range 180°", CMD_RANGE_180),
|
||||||
|
("Spring 140", CMD_SPRING_140),
|
||||||
|
]),
|
||||||
|
"C": ("0xF5 (Désactiver défaut) + Range 180° + Spring 140", [
|
||||||
|
("Disable default 0xF5", CMD_DISABLE_F5),
|
||||||
|
("Range 180°", CMD_RANGE_180),
|
||||||
|
("Spring 140", CMD_SPRING_140),
|
||||||
|
]),
|
||||||
|
"D": ("Range 180° seul (sans ressort)", [
|
||||||
|
("Range 180°", CMD_RANGE_180),
|
||||||
|
("Spring OFF", CMD_SPRING_OFF),
|
||||||
|
]),
|
||||||
|
"0": ("Désactiver force et remettre en 900°", [
|
||||||
|
("Spring OFF", CMD_SPRING_OFF),
|
||||||
|
("Range 900°", CMD_RANGE_900),
|
||||||
|
]),
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
choice = sys.argv[1].upper()
|
||||||
|
else:
|
||||||
|
print("\nOptions à tester :")
|
||||||
|
for k, (desc, _) in tests.items():
|
||||||
|
print(f" [{k}] {desc}")
|
||||||
|
choice = input("\nTon choix : ").strip().upper()
|
||||||
|
|
||||||
|
if choice in tests:
|
||||||
|
desc, steps = tests[choice]
|
||||||
|
print(f"\n▶ Exécution : {desc}")
|
||||||
|
for name, cmd in steps:
|
||||||
|
send_r30(fd, cmd)
|
||||||
|
print(f" -> Envoyé : {name} ({cmd.hex()})")
|
||||||
|
time.sleep(0.05)
|
||||||
|
print("\n👉 TOURNE LE VOLANT :")
|
||||||
|
print(" 1. Est-il dur et revient-il au centre ?")
|
||||||
|
print(" 2. Bloque-t-il bien en butée à ±90° (180° au total) ?")
|
||||||
|
else:
|
||||||
|
print("Choix invalide.")
|
||||||
|
|
||||||
|
os.close(fd)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in new issue
Block a user