kiteretro / Circuit-Sword

GNU General Public License v3.0
134 stars 27 forks source link

TypeError: ord() expected a character, but string of length 0 found #50

Closed wardhus closed 6 years ago

wardhus commented 6 years ago

Following the update instructions to enable the volume wheel I get the following error running

pi@retropie:~/Circuit-Sword $ python cs-configure.py INFO:root:Program Started WARNING:root:WARNING: Bad return for command [u] Traceback (most recent call last): File "cs-configure.py", line 395, in process_menu() File "cs-configure.py", line 307, in process_menu 'joystick_status': get_joystick_adc(), File "cs-configure.py", line 244, in get_joystick_adc 'joy1_x': convert_data({}, 'u', is_binary=False, length=2), File "cs-configure.py", line 192, in convert_data return convert_to_decimal(data) File "cs-configure.py", line 164, in convert_to_decimal for bit in convert_to_fake_byte(byte): File "cs-configure.py", line 157, in convert_to_fake_byte return bin(convert_to_byte(data))[2:].rjust(8, '0')[::-1] File "cs-configure.py", line 159, in convert_to_byte return ord(data) TypeError: ord() expected a character, but string of length 0 found

kiteretro commented 6 years ago

Hi, what hardware version are you running? Is it the most recent (v1.2a) or is it one from a few months ago (v1.1e)?

I'm going to assume it's an older version and it hasn't been updated, which you need to do with the flash-arduino.sh script (https://github.com/kiteretro/Circuit-Sword/wiki/Updating-Arduino-(button-controller)-Firmware#via-the-raspberry-pi)

Update and run again, and let me know the outcome! I need to put a version check in that script.. thanks for reminding me! :)

kiteretro commented 6 years ago

Hi any update on this?

wardhus commented 6 years ago

Sorry for the late reply. You assumed correctly. Flashing the Ardiuino fixed the issue. https://github.com/kiteretro/Circuit-Sword/wiki/Configuring-the-software-without-flashing-the-arduino might need some more information because the title said without flashing :)

Anyway, up to the next issue: I installed the backboard with volume control and enabled analog volume in the configuration:

VOLUME INFORMATION Amp enabled: 1 Current volume: 100% Analog volume enabled: 1 Analog volume adc: 0

But the volume wheel doesn't seem to work. Any advice?

kiteretro commented 6 years ago

Great thanks, I'll work on making that clearer (the reference to flashing was that previously to adjust such things you would have to open the code in Arduino IDE and compile and upload, but now you can just use the cs-configure scipt).

Hm, the "Analog volume adc" is showing 0, when you move the wheel and press ENTER, does that value update at all? Can you double check how it is connected to the board, and if you think it's all ok show some pictures of the set up (where bother ends are connected to)?

wardhus commented 6 years ago

Moving the volume wheel while pressing enter to refresh the value i constantly see a value between 0 and 5. But when i don't move the volume wheel and i refresh it's also a value between 0 and 5.

Once the value jumped up to 243. I'm guessing the 0 - 5 changes is jitter? and the 243 was a valid value. It seems my keys on the back are also unresponsive so a bad connection could be the issue.

I'm unable to open up my gameboy at this time. I'll double check the connections when i can. We'll close this issue and I'll open a new issue when i double checked the connections?

kiteretro commented 6 years ago

Sounds good to me, double check all connections, and with those white connectors (the 3pin one for the analog volume) check inside the board connector to make sure the pins aren't bent (might be hard to see, but if they're bent it should be fairly obvious). Open a new issue if still no luck, but that value you have there should smoothly go from 0 to 1023 (i think) when the wheel changes, and that value is the RAW value the arduino is seeing, so it is a connection type issue :)

Closing this issue