mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Even Realities G1: Fix offby one in new BLE name support
It seems like I didn't actually redeploy the app to my phone when testing my previous change, so I was actually testing the old code (which works with my particular device name). After rebuilding for sure with the new code, I didn't get the indexOf offsets correct. This fixes the bug introduced by the previous change.
This commit is contained in:
+4
-4
@@ -46,10 +46,10 @@ public class G1Constants {
|
||||
// Name will be "G1_XX_[L|R]_YYYYY"
|
||||
int firstUnderScore = deviceName.indexOf('_');
|
||||
if (firstUnderScore < 0) return null;
|
||||
int prefixSize = deviceName.indexOf('_', firstUnderScore);
|
||||
int prefixSize = deviceName.indexOf('_', firstUnderScore + 1);
|
||||
if (prefixSize < 0) return null;
|
||||
|
||||
char side = deviceName.charAt(prefixSize+1);
|
||||
char side = deviceName.charAt(prefixSize + 1);
|
||||
if (side == 'L' || side == 'R') {
|
||||
return side == 'L' ? Side.LEFT : Side.RIGHT;
|
||||
}
|
||||
@@ -61,10 +61,10 @@ public class G1Constants {
|
||||
// Name will be "G1_XX_[L|R]_YYYYY"
|
||||
int firstUnderScore = deviceName.indexOf('_');
|
||||
if (firstUnderScore < 0) return null;
|
||||
int prefixSize = deviceName.indexOf('_', firstUnderScore);
|
||||
int prefixSize = deviceName.indexOf('_', firstUnderScore + 1);
|
||||
if (prefixSize < 0) return null;
|
||||
|
||||
return deviceName.substring(0, prefixSize-1);
|
||||
return deviceName.substring(0, prefixSize);
|
||||
}
|
||||
|
||||
public enum Side {
|
||||
|
||||
Reference in New Issue
Block a user