Comments (8)
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!
from timex_datalink_client.
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
78 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 AA AA AA AA AA
07 20 00 00 07 C2 FF
26 90 05 0E 44 53 49 20 54 6F 79 73 20 70 72 65 73 65 6E 74 73 2E 2E 2E 65 42 72 61 69 6E 21 00 00 00 00 00 36 63
26 91 05 01 02 00 00 00 02 00 07 1E 02 10 00 08 00 01 15 00 7C 90 3E FE 00 97 A5 44 E2 FF 1C 9A 36 FF 00 04 82 64
26 91 05 02 55 01 84 03 30 63 FE 00 00 30 69 FE 00 00 02 02 00 78 ..FEFB /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:35:in chr': -261 out of char range (RangeError) from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:35:in
block (2 levels) in write'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:32:in each' from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:32:in
block in write'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:31:in each' from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client/notebook_adapter.rb:31:in
write'
from /home/jac/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/timex_datalink_client-0.12.2/lib/timex_datalink_client.rb:113:in write' from ebrain.ruby:111:in
from timex_datalink_client.
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:
Values in Hash literals and keyword arguments can be omitted. [Feature #14579]
{x:, y:}
is syntax sugar for{x: x, y: y}
.foo(x:, y:)
is syntax sugar forfoo(x: x, y: y)
.
You can see what Ruby version you're running with this command:
$ ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
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 ~/.rbenv
:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Then add rbenv as a hook to your ~/.bashrc
:
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
Log out of your console and log back in to load the eval
you added to your ~/.bashrc
. Then, add the ruby-build plugin to your local rbenv installation (in ~/.rbenv
):
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
Now you have rbenv! You can now install Ruby 3.2.2 (the latest stable version as of this writing) like this:
rbenv install -v 3.2.2
And then you can set Ruby 3.2.2 as the default Ruby (for only your local Bash sessions) with:
rbenv global 3.2.2
With your new Ruby available, you'll want to install the timex_datalink_client gem for the Ruby 3.2.2 installation:
gem install timex_datalink_client
And you should be good to go! Try running your script; it'll probably work great from here 👍
Let me know how it goes!
from timex_datalink_client.
I just filed this issue! This should help folks in the future 👍
Edit: shipped a PR to address ☝️:
from timex_datalink_client.
Just shipped a fix to README.md to mention the minimum Ruby version, too:
from timex_datalink_client.
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:
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 Time.now
to get the current time, which is constantly changing.
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
)
]
from timex_datalink_client.
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!
from timex_datalink_client.
Hi @bazfum! I just released version 0.12.3 with fixes to accommodate for your issues!
- https://rubygems.org/gems/timex_datalink_client/versions/0.12.3
- https://github.com/synthead/timex_datalink_client/releases/tag/v0.12.3
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:
gem update timex_datalink_client
This should produce output like this:
$ gem update timex_datalink_client
Updating installed gems
Updating timex_datalink_client
Successfully installed timex_datalink_client-0.12.3
Parsing documentation for timex_datalink_client-0.12.3
Installing ri documentation for timex_datalink_client-0.12.3
Done installing documentation for timex_datalink_client after 0 seconds
Parsing documentation for timex_datalink_client-0.12.3
Done installing documentation for timex_datalink_client after 0 seconds
Gems updated: timex_datalink_client
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!
from timex_datalink_client.
Related Issues (20)
- Some spec descriptions are missing an aesthetic terminating quote
- Update Ruby to 3.2.2
- Update gems
- Use clearer description of how CRTs work in README.md
- README.md mentions "supported protocols," even though all protocols are supported
- Use hints about the various applications of the protocols in README.md
- Inconsistency in protocol 9 documentation in Timer example
- Protocol 9 Timer code examples are different than the complete code examples
- Inconsistent examples in protocol 7 documentation for phone numbers
- TimexDatalinkClient#initialize's models param is missing YARDoc documentation for protocol 6 model classes
- ERROR_SEM_TIMEOUT when running sample code HOT 10
- Protocol 6 (Beepwear Pro) is one hour fast on daylight savings time
- Support more characters in protocol 6 (Beepwear Pro)
- Protocol 1 documentation has a small grammatical error
- Add required_ruby_version to gemspec to require Ruby 3.1.0 or greater
- Ruby 3.1.0 requirement should be mentioned in README.md
- Add validation to ensure calendar event time is greater or equal to device time for protocol 7
- Complete code example for protocol 7 uses fixed calendar event times from 2022, and currently raises exceptions
- Add Time spec for protocol 6 to test daylight savings time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timex_datalink_client.