- System.out.printf("Attempting symbols\n");
- version = get_int(hexfile, ao_romconfig_version, 2);
- System.out.printf("version %d\n", version);
- check = get_int(hexfile, ao_romconfig_check, 2);
- System.out.printf("check %d\n", check);
- if (check == (~version & 0xffff)) {
- switch (version) {
- case 2:
- case 1:
- serial_number = get_int(hexfile, ao_serial_number, 2);
- System.out.printf("serial %d\n", serial_number);
- try {
- radio_calibration = get_int(hexfile, ao_radio_cal, 4);
- } catch (AltosNoSymbol missing) {
- radio_calibration = 0;
+ for (int adjust : adjust_rom) {
+ try {
+ version = get_int(hexfile, ao_romconfig_version, 2, adjust);
+ check = get_int(hexfile, ao_romconfig_check, 2, adjust);
+ if (check == (~version & 0xffff)) {
+ System.out.printf("adjust %d version %x check %x success\n", adjust, version, check);
+ switch (version) {
+ case 2:
+ case 1:
+ serial_number = get_int(hexfile, ao_serial_number, 2, adjust);
+ try {
+ radio_calibration = get_int(hexfile, ao_radio_cal, 4, adjust);
+ } catch (AltosNoSymbol missing) {
+ radio_calibration = 0;
+ }
+
+ valid = true;
+
+ /* XXX TeleBT v4.0 units originally shipped without RF calibration programmed. Go fetch
+ * the correct value from the web site
+ */
+ if (serial_number == 2584 ||
+ (3686 <= serial_number && serial_number <= 3938 && radio_calibration == 5695485))
+ {
+ fetch_radio_cal();
+ }
+
+ break;
+ }
+ break;
+ } else {
+ System.out.printf("adjust %d version %x check %x fail\n", adjust, version, check);