procon_bypass_man 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +4 -2
- data/README.md +11 -33
- data/docs/getting_started.md +8 -0
- data/docs/setting/splatoon2_macro_forward_ikarole.md +34 -0
- data/docs/setup_raspi.md +12 -15
- data/docs/setup_raspi_by_mitamae.md +0 -1
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +1 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +2 -1
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +11 -0
- data/lib/procon_bypass_man/bypass/bypass_command.rb +11 -6
- data/lib/procon_bypass_man/bypass/procon_to_switch.rb +44 -41
- data/lib/procon_bypass_man/bypass/switch_to_procon.rb +2 -0
- data/lib/procon_bypass_man/commands/print_boot_message_command.rb +0 -2
- data/lib/procon_bypass_man/configuration.rb +4 -0
- data/lib/procon_bypass_man/device_connection/procon_setting_overrider.rb +0 -3
- data/lib/procon_bypass_man/ephemeral_configuration.rb +9 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/{dasei_cancel.rb → forward_ikarole.rb} +4 -4
- data/lib/procon_bypass_man/plugins.rb +1 -1
- data/lib/procon_bypass_man/procon/analog_stick_manipulator.rb +18 -4
- data/lib/procon_bypass_man/procon/layer_changer.rb +2 -0
- data/lib/procon_bypass_man/procon/macro.rb +2 -0
- data/lib/procon_bypass_man/procon/macro_builder.rb +13 -0
- data/lib/procon_bypass_man/procon/macro_registry.rb +2 -0
- data/lib/procon_bypass_man/procon/performance_measurement/measurements_summarizer.rb +41 -24
- data/lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb +1 -1
- data/lib/procon_bypass_man/procon/performance_measurement.rb +12 -5
- data/lib/procon_bypass_man/procon/rumbler.rb +18 -0
- data/lib/procon_bypass_man/procon/suppress_rumble.rb +2 -0
- data/lib/procon_bypass_man/procon/user_operation.rb +3 -1
- data/lib/procon_bypass_man/procon/value_objects/analog_stick.rb +2 -0
- data/lib/procon_bypass_man/procon/value_objects/binary/inbound_procon_binary.rb +2 -0
- data/lib/procon_bypass_man/procon/value_objects/binary/processing_procon_binary.rb +2 -0
- data/lib/procon_bypass_man/procon/value_objects/rumble_binary.rb +2 -0
- data/lib/procon_bypass_man/procon.rb +28 -18
- data/lib/procon_bypass_man/remote_macro.rb +2 -0
- data/lib/procon_bypass_man/remote_pbm_action.rb +2 -0
- data/lib/procon_bypass_man/runner.rb +0 -1
- data/lib/procon_bypass_man/support/callbacks.rb +10 -3
- data/lib/procon_bypass_man/support/http_client.rb +3 -0
- data/lib/procon_bypass_man/support/renice_command.rb +17 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man.rb +24 -6
- data/procon_bypass_man.gemspec +3 -1
- data/project_template/app.rb +1 -4
- data/project_template/app.rb.erb +1 -4
- data/project_template/setting.yml +3 -0
- metadata +21 -5
- data/docs/setting/splatoon2_macro_dasei_cancel.md +0 -77
- data/lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb +0 -59
@@ -1,77 +0,0 @@
|
|
1
|
-
# スプラトゥーン2: 惰性キャンセル マクロの設定方法
|
2
|
-
|
3
|
-
* 本マクロは実験段階で、オプション名などの仕様が変更される可能性が高いです
|
4
|
-
* procon_bypass_man: 0.1.21以上が必要です
|
5
|
-
|
6
|
-
## 1. install_macro_pluginでマクロを有効化します
|
7
|
-
* `setting.yml` に`install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel` と書きます
|
8
|
-
* これを記述することで、layer内でmacroを呼び出せるようになります
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel
|
12
|
-
```
|
13
|
-
|
14
|
-
## 2. どのlayerで発動するかを宣言します
|
15
|
-
* `setting.yml` のlayer内に`macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_pressed: [:zl]` と書きます
|
16
|
-
* `if_pressed` がどのボタンを押したときにこのマクロが発動するかの設定です
|
17
|
-
* 惰性キャンセルなのでイカ状態になるためにzlを押します
|
18
|
-
* `if_tilted_left_stick` がスティックを倒した時に発動するオプションで、trueを渡すと有効になります
|
19
|
-
* また、傾けた時の閾値を変更することができて、trueの代わりに `{ threshold: 500 }` と書くことができます
|
20
|
-
* デフォルトが500で、ここの数値を上げると、スティックを倒した判定がより厳しくなります。最大1400くらいです。
|
21
|
-
* 連打中に、マクロの発動を無効にしたい場合は `disable_macro` で無効にできます
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
layer :up do
|
25
|
-
macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
|
26
|
-
end
|
27
|
-
```
|
28
|
-
```ruby
|
29
|
-
layer :up do
|
30
|
-
macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: { threshold: 500 }, if_pressed: [:zl]
|
31
|
-
end
|
32
|
-
```
|
33
|
-
```ruby
|
34
|
-
layer :up do
|
35
|
-
disable_macro :all, if_pressed: :a
|
36
|
-
disable_macro :all, if_pressed: :zr
|
37
|
-
macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
|
38
|
-
end
|
39
|
-
```
|
40
|
-
|
41
|
-
## 3. 設定を反映させる
|
42
|
-
* 上記の記述を加えたsetting.ymlを起動中のprocon_bypass_manプロセスで読み込むには、プロセスにその旨を伝える必要があります
|
43
|
-
* ラズベリーパイを再起動して、プロセスを立ち上げ直す、でも目的は達成できますが、もっと簡単にsetting.ymlを再読み込みする必要があります
|
44
|
-
* 書き換えたsetting.ymlを、起動中のprocon_bypass_manプロセスへ即時反映するには、procon_bypass_manプロセスを動かしたまま、別のshellから 以下をを実行してください
|
45
|
-
* setting.ymlのシンタックスが正しければ、switchとの接続が継続したままsetting.ymlの内容を読み込んでいるはずです
|
46
|
-
|
47
|
-
```shell
|
48
|
-
sudo kill -USR2 `cat ./pbm_pid`
|
49
|
-
```
|
50
|
-
|
51
|
-
## 設定例1
|
52
|
-
```yaml
|
53
|
-
version: 1.0
|
54
|
-
setting: |-
|
55
|
-
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
56
|
-
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel
|
57
|
-
|
58
|
-
layer :up do
|
59
|
-
disable_macro :all, if_pressed: :a
|
60
|
-
disable_macro :all, if_pressed: :zr
|
61
|
-
macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
|
62
|
-
end
|
63
|
-
```
|
64
|
-
|
65
|
-
## 設定例2
|
66
|
-
* `open_macro` キーワードを使っても同じことが実行可能です。
|
67
|
-
* この場合は、 `install_macro_plugin` が不要です。
|
68
|
-
|
69
|
-
```yaml
|
70
|
-
version: 1.0
|
71
|
-
setting: |-
|
72
|
-
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
73
|
-
|
74
|
-
layer :up do
|
75
|
-
open_macro :dacan, steps: [:pressing_r_for_0_03sec, :pressing_r_and_pressing_zl_for_0_2sec], if_tilted_left_stick: true, if_pressed: [:zl]
|
76
|
-
end
|
77
|
-
```
|
@@ -1,59 +0,0 @@
|
|
1
|
-
class ProconBypassMan::AnalogStickTiltingPowerScaler
|
2
|
-
DEFAULT_THRESHOLD = 500
|
3
|
-
|
4
|
-
class PowerChunk
|
5
|
-
def initialize(list)
|
6
|
-
@list = list
|
7
|
-
end
|
8
|
-
|
9
|
-
def moving_power
|
10
|
-
max = @list.max
|
11
|
-
min = @list.min
|
12
|
-
moving_power = (max - min).abs
|
13
|
-
end
|
14
|
-
|
15
|
-
def tilting?(threshold: DEFAULT_THRESHOLD, current_position_x: , current_position_y: )
|
16
|
-
# スティックがニュートラルな時
|
17
|
-
if (-200..200).include?(current_position_x) && (-200..200).include?(current_position_y)
|
18
|
-
return false
|
19
|
-
end
|
20
|
-
|
21
|
-
moving_power >= threshold
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize
|
26
|
-
@map = {}
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [NilClass, Chunk] ローテトしたらvalueを返す
|
30
|
-
def add_sample(value)
|
31
|
-
rotated = nil
|
32
|
-
current_key = key
|
33
|
-
if @map[current_key].nil?
|
34
|
-
rotated = rotate
|
35
|
-
@map = { current_key => [] } # renew or initialize
|
36
|
-
end
|
37
|
-
|
38
|
-
@map[current_key] << value
|
39
|
-
rotated
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
# 0.1sec刻みで進行する
|
45
|
-
def key
|
46
|
-
time = Time.now
|
47
|
-
m1 = time.strftime('%L')[0]
|
48
|
-
[time.to_i, m1].join.to_i
|
49
|
-
end
|
50
|
-
|
51
|
-
def rotate
|
52
|
-
list = @map.values.first
|
53
|
-
if list
|
54
|
-
return PowerChunk.new(list)
|
55
|
-
else
|
56
|
-
return nil
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|