-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax errors, no idea where to start #316
Comments
Heya! Very fun story about your e-BRAIN, and thanks for filing this issue! It appears that you're attempting to use this lib with an old Ruby version! This lib uses omitted keyword arguments, which is a feature introduced in Ruby 3.1.0:
You can see what Ruby version you're running with this command:
To get a newer version of Ruby, I recommend rbenv! This will let you build and install Ruby as a local installation in your home directory. This allows you to install any recent version without relying on your distro to supply it for you. Here's how you can get rbenv running on your Raspberry Pi 400! First, clone rbenv to
Then add rbenv as a hook to your
Log out of your console and log back in to load the
Now you have rbenv! You can now install Ruby 3.2.2 (the latest stable version as of this writing) like this:
And then you can set Ruby 3.2.2 as the default Ruby (for only your local Bash sessions) with:
With your new Ruby available, you'll want to install the timex_datalink_client gem for the Ruby 3.2.2 installation:
And you should be good to go! Try running your script; it'll probably work great from here 👍 Let me know how it goes! |
I just filed this issue! This should help folks in the future 👍 Edit: shipped a PR to address ☝️: |
Just shipped a fix to README.md to mention the minimum Ruby version, too: |
Thanks, that got me through a lot of progress! I had to update the Pi more than I'd expected since the compiler wasn't working, and then had to trace down a few dependancies but that's par for the course. I'm now getting some data transferred and then an error: jac@pi400:~ $ ruby ebrain.ruby |
Hey great! I'm really glad this got the gem working! Thank you for sharing your progress! This is a really interesting one! I was able to reproduce this on my end, and I found that the negative integer (that's supposed to represent a byte) is originating from this method: timex_datalink_client/lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb Lines 26 to 32 in f80d9d1
I discovered that the negative number comes from comparing dates between the current time and calendar events. At some point, an error state happens when the synced time is too far in the future compared to an event. The unit tests for this class still pass because all the times in the tests are fixed. The complete code example in the protocol 7 documentation doesn't work because it uses I'll get a fix up for this soon! In the meantime, you can simply omit the calendar events or set the events to a later time, i,e, 2023 instead of 2022. For example, here is the updated events array with the updated year that is tested to work: events = [
TimexDatalinkClient::Protocol7::Eeprom::Calendar::Event.new(
time: Time.new(2023, 12, 13, 9, 0, 0),
phrase: breakfast_with_cousins
),
TimexDatalinkClient::Protocol7::Eeprom::Calendar::Event.new(
time: Time.new(2023, 12, 13, 19, 0, 0),
phrase: crashing_around_the_house
)
] |
Interesting. After making those changes the file transmits fine as far as the Pi is concerned. It seems like getting it to receive all the data happily will require some trial and error on LED positioning. Thanks for all the assistance! |
Ah great! I'm glad to hear that! Have fun playing with your e-BRAIN! 😄 The e-BRAIN has a really insensitive optical sensor, and yeah, you really have to blast it with light for it to transfer reliably. I haven't tested syncing it with a CRT, but it seems like it would be difficult to have a successful transfer that way, too. On my DIY Notebook Adapter, I have an external LED soldered to it, and it works great. On a Datalink 150, I can sync it from several feet away. It also syncs to an e-BRAIN nicely. You might consider soldering an LED onto your own adapter for a reliable transfer 🙂 Here's my personal Teensy LC with an LED soldered onto it! More information about this here! |
Hi @bazfum! I just released version 0.12.3 with fixes to accommodate for your issues!
Here are the pull requests that target the problems you were seeing:
This new release does not add any functional changes to any current happy paths, so if your code is working now, it should continue to work. However, if your Ruby version is too old or your e-BRAIN calendar events are in the past, meaningful errors will now be raised (instead of the obscure, uncaught ones in v0.12.2). Additionally, the protocol 7 (e-BRAIN) documentation now uses calendar event times based on the device time by using times for tomorrow. This will ensure that the complete code example will always work, no matter what the current time is 👍 To obtain the latest version of timex_datalink_client, simply do this in a console:
This should produce output like this:
Since you got your e-BRAIN working, I'll go ahead and close this issue since the bugs have been fixed 👍 Feel free to reopen this issue or file a new one if you run into any more problems! |
I saw this and remembered I had an E-Brain sitting around from a clearance sale 20 years ago. I've flashed my Pico and installed Ruby and the GEM on a Raspberry Pi 400. I extracted the voice file from the ISO as well. I then copied the example script to a file as-is to verify things work before hacking around more. Unfortunately I get some syntax errors, and having never used Ruby before I'm at a loss. Any help would be appreciated.
pi@raspberrypi:~ $ ruby ebrain.ruby
'Traceback (most recent call last):
2: from ebrain.ruby:1:in
<main>' 1: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in
require'/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in
require': cannot load such file -- timex_datalink_client (LoadError) 3: from ebrain.ruby:1:in
2: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:149:in
require' 1: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:160:in
rescue in require'/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:160:in `require': /var/lib/gems/2.7.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client.rb:127: syntax error, unexpected ',' (SyntaxError)
serial_device:,
^
The text was updated successfully, but these errors were encountered: