ladder_drive 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/NEWS +7 -0
- data/README.md +11 -0
- data/README_jp.md +12 -0
- data/lib/ladder_drive/tasks/build.rb +52 -0
- data/lib/ladder_drive/version.rb +1 -1
- data/lib/plc/raspberrypi/raspberrypi_plc.rb +2 -2
- data/template/raspberrypi/lddrive +5 -0
- data/template/raspberrypi/lddrive.service +12 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f4231540625526b7fd6fbfc169a81e03b1263b9
|
4
|
+
data.tar.gz: 5564a1fcdacdfa69ac431d70f47043127d492a2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8830bcdcea99c2dcb5f81474b5e13458a9cf075c0cbbf13762b9c4d03825a9983ba635aa5de00c4210069ca555f1897875727804ff7016d97cd8236923cd19
|
7
|
+
data.tar.gz: 5a7a21040c260cee1bf3769e1fef2507e447dfba2990586bc820dba6dbc30250c1e1f20a6c0c64e268337a794d52e24c7f62a0c28cb5931b499a2eaf934aa61b
|
data/Gemfile.lock
CHANGED
data/NEWS
ADDED
data/README.md
CHANGED
@@ -235,6 +235,17 @@ You can specify pull up or pull down and invert options for input.
|
|
235
235
|
pin: 42
|
236
236
|
```
|
237
237
|
|
238
|
+
### Run Ladder Drive as a service
|
239
|
+
|
240
|
+
Follow these steps to run ladder drive as a service at your project directory.
|
241
|
+
|
242
|
+
```
|
243
|
+
$ sudo rake service:install
|
244
|
+
$ sudo rake service:enable
|
245
|
+
$ sudo rake service:start
|
246
|
+
```
|
247
|
+
[![LadderDrive on Raspberry Pi](http://img.youtube.com/vi/UBhSaRNp_gM/0.jpg)](http://www.youtube.com/watch?v=UBhSaRNp_gM)
|
248
|
+
|
238
249
|
|
239
250
|
# Accessing a device values
|
240
251
|
|
data/README_jp.md
CHANGED
@@ -248,6 +248,18 @@ pinにGPIO番号を指定します。
|
|
248
248
|
pin: 42
|
249
249
|
```
|
250
250
|
|
251
|
+
### サービスとして Ladder Drive を起動
|
252
|
+
|
253
|
+
電源投入でLadder Driveが起動する様にサービスとして立ち上げることができます。
|
254
|
+
Ladder Driveプロジェクのディレクトリで以下のコマンドを実行することでサービスを立ち上げることができます。
|
255
|
+
|
256
|
+
```
|
257
|
+
$ sudo rake service:install
|
258
|
+
$ sudo rake service:enable
|
259
|
+
$ sudo rake service:start
|
260
|
+
```
|
261
|
+
|
262
|
+
[![LadderDrive on Raspberry Pi](http://img.youtube.com/vi/UBhSaRNp_gM/0.jpg)](http://www.youtube.com/watch?v=UBhSaRNp_gM)
|
251
263
|
|
252
264
|
## PLCデバイスへのアクセスツールとしての利用
|
253
265
|
|
@@ -98,4 +98,56 @@ task :console => :upload do
|
|
98
98
|
c.run
|
99
99
|
end
|
100
100
|
|
101
|
+
namespace :service do
|
102
|
+
|
103
|
+
desc "Install as a service."
|
104
|
+
task :install do
|
105
|
+
# copy lddrive to current directory.
|
106
|
+
dir = Dir.pwd
|
107
|
+
root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))
|
108
|
+
template_dir = File.join(root_dir, "template", "raspberrypi")
|
109
|
+
fname = "lddrive"
|
110
|
+
cp_r File.join(template_dir, fname), fname, verbose:false
|
111
|
+
|
112
|
+
# copy lddrive.serive file to /etc/systemd/system
|
113
|
+
fname = "lddrive.service"
|
114
|
+
s = File.read(File.join(template_dir, fname))
|
115
|
+
s.gsub!("<%= exec_start %>", "/home/pi/project/lddrive")
|
116
|
+
File.write File.join("/etc", "systemd", "system", fname), s
|
117
|
+
|
118
|
+
# reload services
|
119
|
+
system("systemctl daemon-reload")
|
120
|
+
|
121
|
+
puts "Successfuly installed lddrive serivice."
|
122
|
+
end
|
123
|
+
|
124
|
+
desc "Uninstall as a service."
|
125
|
+
task :uninstall do
|
126
|
+
path = File.join("/etc", "systemd", "system", "lddrive.service")
|
127
|
+
rm path if File.exist? path
|
128
|
+
puts "Successfuly uninstalled lddrive serivice."
|
129
|
+
end
|
130
|
+
|
131
|
+
desc "Enable a service"
|
132
|
+
task :enable do
|
133
|
+
system "systemctl enable lddrive.service"
|
134
|
+
end
|
135
|
+
|
136
|
+
desc "Disable a service"
|
137
|
+
task :disable do
|
138
|
+
system "systemctl disable lddrive.service"
|
139
|
+
end
|
140
|
+
|
141
|
+
desc "Start a service"
|
142
|
+
task :start do
|
143
|
+
system "systemctl start lddrive.service"
|
144
|
+
end
|
145
|
+
|
146
|
+
desc "Stop a service"
|
147
|
+
task :stop do
|
148
|
+
system "systemctl stop lddrive.service"
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
101
153
|
task :default => :console
|
data/lib/ladder_drive/version.rb
CHANGED
@@ -41,7 +41,7 @@ module Raspberrypi
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def setup_io
|
44
|
-
@available_pi_piper =
|
44
|
+
@available_pi_piper = true
|
45
45
|
@io_dict = { inputs:[], outputs:[] }
|
46
46
|
config[:io][:inputs].each do |dev, info|
|
47
47
|
@io_dict[:inputs] << [device_by_name(dev), Pin.new(pin:info[:pin], direction: :in, pull:(info[:pull].to_sym || :off), invert:info[:invert])]
|
@@ -49,10 +49,10 @@ module Raspberrypi
|
|
49
49
|
config[:io][:outputs].each do |dev, info|
|
50
50
|
@io_dict[:outputs] << [device_by_name(dev), Pin.new(pin:info[:pin], direction: :out)]
|
51
51
|
end
|
52
|
-
@available_pi_piper = true
|
53
52
|
rescue NoMethodError
|
54
53
|
puts "WARN: defention of io is missing!"
|
55
54
|
rescue LoadError
|
55
|
+
@available_pi_piper = false
|
56
56
|
puts "WARN: pi_piper is not available in this system!"
|
57
57
|
end
|
58
58
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ladder_drive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuyoshi Ito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- Gemfile
|
100
100
|
- Gemfile.lock
|
101
101
|
- LICENSE
|
102
|
+
- NEWS
|
102
103
|
- README.md
|
103
104
|
- README_jp.md
|
104
105
|
- Rakefile
|
@@ -166,6 +167,8 @@ files:
|
|
166
167
|
- template/ladder_drive/Rakefile
|
167
168
|
- template/ladder_drive/asm/main.esc
|
168
169
|
- template/ladder_drive/config/plc.yml
|
170
|
+
- template/raspberrypi/lddrive
|
171
|
+
- template/raspberrypi/lddrive.service
|
169
172
|
homepage: https://github.com/ito-soft-design/ladder_drive
|
170
173
|
licenses:
|
171
174
|
- MIT
|