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:
jrthomas270
2025-10-11 16:40:06 -07:00
parent 39918f74ab
commit 7ee1f67c54
@@ -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 {