Sfoglia il codice sorgente

Changing default bindings

Edgar 1 mese fa
parent
commit
9ef6d8df23
2 ha cambiato i file con 4 aggiunte e 17 eliminazioni
  1. 3 16
      OpenPuck/mode_switch2_pro.cpp
  2. 1 1
      docs/index.html

+ 3 - 16
OpenPuck/mode_switch2_pro.cpp

@@ -78,7 +78,8 @@ static volatile uint32_t g_sw2Counter32 = 0;
 static int8_t g_sw2LastRumbleBond = -1;
 static uint16_t g_sw2LastRumbleLeft = 0;
 static uint16_t g_sw2LastRumbleRight = 0;
-static uint8_t g_sw2Map[8] = { 19, 20, 23, 22, 9, 10, 11, 18 };
+static const uint8_t def[8] = { 18, 18, 23, 22, 9, 10, 11, 21 };
+static uint8_t g_sw2Map[8];
 static bool g_sw2MapLoaded = false;
 
 static void switch2ProLoadMap()
@@ -86,13 +87,6 @@ static void switch2ProLoadMap()
 	if (g_sw2MapLoaded)
 		return;
 	g_sw2MapLoaded = true;
-	static const uint8_t legacyDef[7] = { 9, 10, 23, 22, 18, 11, 21 };
-	static const uint8_t def[8] = { 19, 20, 23, 22, 9, 10, 11, 18 };
-	const bool qamMissing = cfgExtRead(10u) == 0xffu;
-	bool migrateLegacyDefaults = qamMissing;
-	for (uint8_t i = 0; i < 7 && migrateLegacyDefaults; i++)
-		migrateLegacyDefaults = cfgExtRead((uint8_t)(3u + i)) ==
-					legacyDef[i];
 	bool normalize = false;
 	for (uint8_t i = 0; i < 8; i++) {
 		const uint8_t saved = cfgExtRead((uint8_t)(3u + i));
@@ -104,13 +98,6 @@ static void switch2ProLoadMap()
 			normalize = true;
 		}
 	}
-	if (migrateLegacyDefaults) {
-		for (uint8_t i = 0; i < 7; i++) {
-			g_sw2Map[i] = def[i];
-			cfgExtWrite((uint8_t)(3u + i), def[i]);
-		}
-		normalize = true;
-	}
 	if (normalize)
 		saveCfg();
 }
@@ -911,7 +898,7 @@ bool switch2ProVendorControlXfer(uint8_t rhport, uint8_t stage,
 	memcpy(g_sw2ControlReply, SW2_VENDOR_PROTOCOL,
 	       sizeof SW2_VENDOR_PROTOCOL);
 	return tud_control_xfer(rhport, request, g_sw2ControlReply,
-				sizeof SW2_VENDOR_PROTOCOL);
+					sizeof SW2_VENDOR_PROTOCOL);
 }
 
 static void sw2DriverInit(void)

+ 1 - 1
docs/index.html

@@ -963,7 +963,7 @@ function applyBlob(p){
 
   // Eight Switch 2 Pro physical-source mappings occupy payload p[194..201].
   const sw2MapCap=(p[0]>=23 && p.length>201);
-  const sw2Map=sw2MapCap?p.slice(194,202):[19,20,23,22,9,10,11,18];
+  const sw2Map=sw2MapCap?p.slice(194,202):[18,18,23,22,9,10,11,21];
   // per-slot link status (protocol v8, p.length >= 73)
   const hasSlotsData = p.length >= 73;
   if (hasSlotsData) {