papirus 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -8
  3. data/lib/papirus.rb +18 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7922a759efaac058b340469a65cb2ae523805fc3
4
- data.tar.gz: 8b47d280f358a191fdc2682f1a5eeccb1daa2694
3
+ metadata.gz: a76933b098f5b78df7b2d885b938f171fa79896d
4
+ data.tar.gz: e8d561a393c6380ef13b0c674a4e62171dbd30de
5
5
  SHA512:
6
- metadata.gz: f2431df7210edc30a3f5983156968b8eeaec567f737982976f8a483e6fa3541eb309813d54ceb3abcd0b8a36d7d0a8ecccca7d4079aff29212568bab47bc1a3f
7
- data.tar.gz: 5a21d57e6c0f22c98fb0d8ac7789bc02d18e6fb8e913b2f012b064570cf09d9ade75c07e558b7989e698129d637387ddab12622370403fd8c9457a11a56fff11
6
+ metadata.gz: 97fcf810d33adf0868454ffd407a71ee2038032cec814a3bdc771302db9b9f1535d928c5c59b0c66456014495c0bb3e075e8e657d2c3c001b88d54ba630d4d22
7
+ data.tar.gz: d561835c1dfa3dfda5f73918bcccc5ef9cc210498cc137dc84ff1a179bb59b9ee37b352af94e9b5e9afa7f2de2b4a13e6d8b40485a1970a53bd0ab5ac6621230
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # papirus
2
2
 
3
- ruby gem to talk to the [PaPiRus](https://www.pi-supply.com/?s=papirus&post_type=product&tags=1&limit=5&ixwps=1) display
3
+ Ruby gem to talk to the [PaPiRus](https://www.pi-supply.com/?s=papirus&post_type=product&tags=1&limit=5&ixwps=1) display from a Raspberry PI
4
4
 
5
- before you start playing make sure you got the display driver installed (gratis/edp-fuse)
5
+ Before you start playing make sure you got the display driver installed (gratis/edp-fuse) on your PI
6
6
 
7
- ## epaper fuse driver installation instructions (if you have not done that already ::)
8
7
  ```bash
8
+ ssh yourpi
9
9
  sudo apt-get install libfuse-dev -y
10
10
 
11
11
  git clone https://github.com/repaper/gratis.git
@@ -16,9 +16,9 @@ systemctl enable epd-fuse.service
16
16
  systemctl start epd-fuse
17
17
  ```
18
18
 
19
- You can find more detailed instructions and updates at the [https://github.com/repaper/gratis](gratis) repo
19
+ You can find more detailed instructions and updates at the [gratis](https://github.com/repaper/gratis) repo
20
20
 
21
- ## gem installation (add sudo if your not useing [https://rvm.io/](rvm))
21
+ ## gem installation (add sudo if your not using [RVM](https://rvm.io/))
22
22
 
23
23
  ```bash
24
24
  $ gem install papirus
@@ -68,7 +68,7 @@ require 'papirus'
68
68
  require 'papirus/rmagick'
69
69
 
70
70
  display = PaPiRus::Display.new()
71
- image = Magick::Image::read('/path/to/img/file.(png|jpg|etc)'.first
71
+ image = Magick::Image::read('/path/to/img/file.[png|jpg|etc]').first
72
72
  display.show(image.to_bit_stream(display.width, display.height))
73
73
  ```
74
74
 
@@ -142,11 +142,13 @@ end
142
142
  If you want to test the gem, but don't have your PaPiRus available, you can do the following
143
143
 
144
144
  * clone this repo
145
- * run the createtestepd.sh script that is in the repo which creates the needed files and folders in /tmp/epd
146
145
  * start irb
147
146
  * require 'papirus'
147
+ The gem will create the epd_path test folder and will add all params for the 2.0 panel
148
148
  * display = PaPiRus::Display.new(epd_path: '/tmp/epd')
149
- * play with the examples above
149
+ When you want to add the 2.7 display panel, you would do
150
+ * display = PaPiRus::Display.new(epd_path: '/tmp/epd', width: 264, height: 176, panel: 'EPD 2.7')
151
+ Now play with the examples above
150
152
  * when you run `display.show` the **fake** display /tmp/epd/LE/display is filled with your image
151
153
  * now you can use a bin editor like xxd to have a look at the result: `xxd -b /tmp/epd/LE/display`
152
154
  * or, use `image.inspect_bitstream(display.width, display.height)` to dump the image as 1's and 0's to the terminal
@@ -165,6 +167,7 @@ Where
165
167
 
166
168
  ## TODO
167
169
 
170
+ * tests
168
171
  * make the image.to_bit_stream routine faster (as it is now to slow to do animations with partial updates)
169
172
  * add support for reading the temperature of the display
170
173
  * add support for changing the update rate
@@ -12,7 +12,23 @@ module PaPiRus
12
12
  # or 'C' for clearing the screen
13
13
  attr_reader :allowed_commands
14
14
 
15
- def initialize(epd_path: '/dev/epd', width: 200, height: 96, panel: 'EPD 2.0', cog: 0, film: 0, auto: false, inverse: false, rotation: 0)
15
+ def initialize(epd_path: '/dev/epd', width: 200, height: 96, panel: 'EPD 2.0', cog: 2, film: 231, auto: false, inverse: false, rotation: 0)
16
+ if epd_path != '/dev/epd'
17
+ # assuming we use a test dir and it is not created yet
18
+ require 'fileutils'
19
+ raise 'epd test path should be located somewhere in /tmp/' unless epd_path =~ /\/tmp\/\w+/
20
+ if File.exists?(epd_path)
21
+ #remove old test dir as it may be a different screen size/type
22
+ FileUtils.rm_f(epd_path)
23
+ end
24
+ FileUtils.mkdir_p(File.join([epd_path, 'LE']))
25
+ %w{command LE/display, LE/display_inverse}.each do |file|
26
+ FileUtils.touch File.join([epd_path, file])
27
+ end
28
+ File.open(File.join([epd_path, 'panel']), 'w+') do |file|
29
+ file.write %{#{panel} #{width}x#{height} COG #{cog} FILM #{film}\n}
30
+ end
31
+ end
16
32
  #transver all vars to attr's
17
33
  method(__method__).parameters.each do |type, k|
18
34
  next unless type == :key
@@ -24,7 +40,7 @@ module PaPiRus
24
40
  end
25
41
 
26
42
  def show(*args)
27
- raise 'you need to al least provide raw imagedata' if args.length == 0
43
+ raise 'you need to at least provide raw imagedata' if args.length == 0
28
44
  data = args[0]
29
45
  updatemethod = args[1] || 'U'
30
46
  File.open(File.join(@epd_path, "LE", "display#{@inverse ? '_inverse': ''}"), 'wb') do |io|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papirus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mischa Molhoek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-13 00:00:00.000000000 Z
11
+ date: 2017-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.6.13
120
+ rubygems_version: 2.5.1
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: ruby gem to access the PaPiRus display