procon_bypass_man 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '019476402097b5b57976cd88c61d41b23c9eb7e6195a0f49240d4d89db9622a6'
4
- data.tar.gz: '0590db283b885d28994ab318393876c2fc1acc3082960dbe7adaaec5c7080d21'
3
+ metadata.gz: d4ffa6c5a0eca5298143505c133f6895f7bb33b6061a36e6123c27e19a0ffcbb
4
+ data.tar.gz: 74e77a823d913769a75b2dd698991bb1fed6a62a1da9a65928e00b86773e90df
5
5
  SHA512:
6
- metadata.gz: e0e858601e6a4d98c5e7cd6eafafccf3e123c3ea956f70398d3382c6239aef888b84210a028b18b763cf8865b4b645181fa9c5f3d9f29047cd639a706979b0eb
7
- data.tar.gz: 455638d194448fa0a535915e585519486b423828251de66f345e3888269b15f34c459cb55266ec08f271aa114a92f927195b1ef0e9621422695cfea356548a35
6
+ metadata.gz: 90cbb299a402bbab3fae219fc17b359155b48c67cf34761ad69c63ee5ba72ed7cf356d5829ee003d19558c7418f07444d7f35619d82bebc124975ab1c40cb85f
7
+ data.tar.gz: f03f39550078285114b0a7ac209938dee7b335c99689cba48ed4d4f4d62e659b0fb1fcea51bd800acfe61839cc92c235f5112e3adc5a3896e033f5dbfa224373
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
+ ## [0.3.5] - 2022-2-9
2
+ * 設定ファイルに起動な必要なPBMのバージョンを表記できるようになりました
3
+ * https://github.com/splaplapla/procon_bypass_man/pull/238
4
+ * レイヤー変更ボタン(prefix_keys_for_changing_layer)が空欄の時に設定ファイルをエラーにしないようになりました
5
+ * PBM-CloudからPBMをアップグレードするときに、古いバージョンを削除するようにしました
6
+
1
7
  ## [0.3.4] - 2022-12-26
2
8
  * 左スティックを1回転するマクロを追加しました
3
- * 詳しい設定方法については docs/setting/splatoon3_rotation_forward_stick.md を参照してください
9
+ * 詳しい設定方法については docs/setting/splatoon3_rotation_left_stick.md を参照してください
4
10
  * プログラムの停止時・再読み込み時に時間がかかってた不具合を修正しました
5
11
 
6
12
  ## [0.3.3.1] - 2022-11-13
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- procon_bypass_man (0.3.4)
4
+ procon_bypass_man (0.3.5)
5
5
  action_cable_client
6
6
  blue_green_process (= 0.1.4.2)
7
- pbmenv (>= 0.1.9)
7
+ pbmenv (>= 0.1.11)
8
8
  sorted_set
9
9
 
10
10
  GEM
@@ -38,7 +38,7 @@ GEM
38
38
  parallel (1.21.0)
39
39
  parser (3.0.3.2)
40
40
  ast (~> 2.4.1)
41
- pbmenv (0.1.10)
41
+ pbmenv (0.1.11)
42
42
  pry (0.14.1)
43
43
  coderay (~> 1.1)
44
44
  method_source (~> 1.0)
data/README.md CHANGED
@@ -38,7 +38,7 @@ https://user-images.githubusercontent.com/1664497/171327108-f12f56a5-fc36-48da-9
38
38
  * レイヤーを切り替える方法は?
39
39
  * 設定ファイルに記述している `prefix_keys_for_changing_layer`の後ろにあるキーを同時押しながら、十字キーのどれかを押すことで任意のレイヤーに切り替わります
40
40
  * このツールでできることは?
41
- * キーリマップ, 連射, マクロ, 特定の同じ操作の繰り返し(mode)
41
+ * キーリマップ, 連射, マクロ
42
42
  * リマップは1つのキーを別のキーに割り当てます
43
43
  * 連射中には特定のキーの入力を無視したり、複数のキーをトリガーに連射することができます
44
44
  * どうしてsudoが必要なの?
@@ -80,13 +80,6 @@ sudo kill -USR2 `cat ./pbm_pid`
80
80
  * githubのreleaseを作成する
81
81
  -->
82
82
 
83
- ## Raspberry Pi4のセットアップを代行します
84
- * Raspberry Pi4を開発者である私の家に配送してくれれば、セットアップを代行します。セットアップが終わり次第送り返します
85
- * 使い方に関しては、https://pbm-cloud.jiikko.com ですべて完結するので、Linuxの知識は不要です
86
- * 何か問題が起きた時はリモートログインでサポート可能です
87
- * 希望者はDiscordの `kawagu#7684` にDMを送ってください
88
- * お金はかかりません
89
-
90
83
  ## 開発を支援してくれる人を募集しています
91
84
  * https://jiikko.fanbox.cc/
92
85
  * procon_bypassの運営・開発・サーバー費用に充てさせていただきます。また、問い合わせに優先して対応します。
@@ -3,17 +3,16 @@
3
3
  * [はじめに](#はじめに)
4
4
  * [procon_bypass_manで解決したいこと](#procon_bypass_manで解決したいこと)
5
5
  * [procon_bypass_manでできること](#procon_bypass_manでできること)
6
- * [セットアップを代行できます](#セットアップを代行できます)
7
6
  * [セットアップ](#セットアップ)
8
7
  * [ラズベリーパイのセットアップ](#ラズベリーパイのセットアップ)
9
8
  * [procon_bypass_manのインストール](#procon_bypass_manのインストール)
10
9
  * [pbmenvを使う方法](#pbmenvを使う方法)
11
10
  * [pbmenvを使わない方法](#pbmenvを使わない方法)
11
+ * [RaspberryPiの給電について](#RaspberryPiの給電について)
12
12
  * [普段使いをするためのセットアップ](#普段使いをするためのセットアップ)
13
13
  * [レイヤー](#レイヤー)
14
14
  * [マクロ](#マクロ)
15
15
  * [左スティックの感度調整](#左スティックの感度調整)
16
- * [入力表示](#入力表示)
17
16
  * [設定ファイルの書き方](#設定ファイルの書き方)
18
17
  * プラグインの書き方
19
18
  * [設定ファイルの書き方がわからない、エラーが起きるとき](#設定ファイルの書き方がわからない、エラーが起きるとき)
@@ -43,15 +42,10 @@
43
42
  * [設定方法](/docs/setting/left-analogstick-cap.md)
44
43
  * WEBから設定状態の閲覧・反映
45
44
  * ボタンリマップ
45
+ <!--
46
46
  * 入力表示
47
47
  * https://github.com/splaplapla/switch-procon-input-viewer
48
-
49
- ## セットアップを代行できます
50
- * Raspberry Pi4を開発者である私の家に配送してくれれば、セットアップを代行します。セットアップが終わり次第送り返します
51
- * 使い方に関しては、https://pbm-cloud.jiikko.com ですべて完結するので、Linuxの知識は不要です
52
- * 何か問題が起きた時はリモートログインでサポート可能です
53
- * 希望者はDiscordの `kawagu#7684` にDMを送ってください
54
- * お金はかかりません
48
+ -->
55
49
 
56
50
  ## セットアップ
57
51
  ### ラズベリーパイのセットアップ
@@ -123,6 +117,14 @@ wget https://raw.githubusercontent.com/jiikko/procon_bypass_man_sample/master/se
123
117
  sudo /home/pi/.rbenv/versions/3.0.1/bin/ruby app.rb
124
118
  ```
125
119
 
120
+ ## RaspberryPiの給電について
121
+ Raspberry Piの状態によっては、Switchと接続しているときに、Raspberry Piが電力不足になるようで動作が不安定になることがあります。
122
+ 不安定になるようであれば、Switch以外からも給電してみてください。詳細には言及しませんが、主な給電方法には、以下があります。
123
+
124
+ * GPIO端子
125
+ * セルフパワーUSBハブ
126
+ * PoE
127
+
126
128
  ## 普段使いをするためのセットアップ
127
129
 
128
130
  procon_bypass_manを起動するだけでプロコンと接続ができるようになったら、Raspberry Piを起動したときにprocon_bypass_manも自動起動するように設定しましょう。
@@ -215,9 +217,11 @@ open_macro :sokuwari, steps: [:toggle_r_for_0_2sec, :toggle_thumbr_for_0_14sec,
215
217
  ## 左スティックの感度調整
216
218
  [左スティックの感度調整](/docs/setting/left-analogstick-cap.md)
217
219
 
220
+ <!--
218
221
  ## 入力表示
219
222
  * 使い方は https://github.com/splaplapla/switch-procon-input-viewer を参照してください。
220
223
  * https://zenn.dev/jiikko/articles/2ef0ccbdfe0fe7 に技術的な解説を書きました
224
+ -->
221
225
 
222
226
  ## 設定ファイルの書き方
223
227
  設定ファイルは、ymlフォーマットに埋め込まれたRubyスクリプトで記述します。
@@ -3,6 +3,13 @@
3
3
  * 本マクロは実験段階で、オプション名などの仕様が変更される可能性が高いです
4
4
  * procon_bypass_man: 0.3.3以上が必要です
5
5
 
6
+
7
+
8
+ https://user-images.githubusercontent.com/1664497/210229394-493a7ad4-b4cf-4dfd-87da-2398494e00fd.mp4
9
+
10
+
11
+
12
+
6
13
  ## 1. install_macro_pluginでマクロを有効化します
7
14
  * `setting.yml` に`install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::DaseiCancel` と書きます
8
15
  * これを記述することで、layer内でmacroを呼び出せるようになります
@@ -12,7 +12,7 @@ https://user-images.githubusercontent.com/1664497/205416889-d458668e-ab46-4867-8
12
12
  version: 1.0
13
13
  setting: |-
14
14
  prefix_keys_for_changing_layer [:zr, :zl, :l]
15
- install_macro_plugin(ProconBypassMan::Plugin::Splatoon2::Macro::RotationLeftStick)
15
+ install_macro_plugin(ProconBypassMan::Plugin::Splatoon3::Macro::RotationLeftStick)
16
16
 
17
17
  layer :up do
18
18
  macro ProconBypassMan::Plugin::Splatoon3::Macro::RotationLeftStick, if_pressed: [:left]
@@ -0,0 +1,11 @@
1
+ class ProconBypassMan::ReportWarningJob < ProconBypassMan::ReportEventBaseJob
2
+ extend ProconBypassMan::HasExternalApiSetting
3
+
4
+ # @param [String] body
5
+ def self.perform(body)
6
+ ProconBypassMan::ReportHttpClient.new(
7
+ path: path,
8
+ server: api_server,
9
+ ).post(body: body, event_type: :warn)
10
+ end
11
+ end
@@ -9,6 +9,7 @@ require "procon_bypass_man/background/jobs/report_reload_config_job"
9
9
  require "procon_bypass_man/background/jobs/report_error_reload_config_job"
10
10
  require "procon_bypass_man/background/jobs/report_load_config_job"
11
11
  require "procon_bypass_man/background/jobs/report_error_job"
12
+ require "procon_bypass_man/background/jobs/report_warning_job"
12
13
  require "procon_bypass_man/background/jobs/report_completed_upgrade_pbm_job"
13
14
  require "procon_bypass_man/background/jobs/report_procon_performance_measurements_job"
14
15
  require "procon_bypass_man/background/jobs/sync_device_stats_job"
@@ -1,4 +1,5 @@
1
1
  require "procon_bypass_man/buttons_setting_configuration/param_normalizer"
2
+ require "procon_bypass_man/buttons_setting_configuration/metadata_loader"
2
3
 
3
4
  module ProconBypassMan
4
5
  class ButtonsSettingConfiguration
@@ -9,6 +10,11 @@ module ProconBypassMan
9
10
  def self.load(setting_path: )
10
11
  ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path = setting_path
11
12
 
13
+ metadata_loader = ProconBypassMan::ButtonsSettingConfiguration::MetadataLoader.load(setting_path: setting_path)
14
+ if(Gem::Version.new(metadata_loader.required_pbm_version) >= Gem::Version.new(ProconBypassMan::VERSION))
15
+ ProconBypassMan::SendErrorCommand.execute(error: '起動中のPBMが設定ファイルのバージョンを満たしていません。設定ファイルが意図した通り動かない可能性があります。PBMのバージョンをあげてください。')
16
+ end
17
+
12
18
  ProconBypassMan::ButtonsSettingConfiguration.switch_new_context(:validation) do |new_instance|
13
19
  yaml = YAML.load_file(setting_path) or raise "読み込みに失敗しました"
14
20
  new_instance.instance_eval(yaml["setting"])
@@ -0,0 +1,27 @@
1
+ module ProconBypassMan
2
+ class ButtonsSettingConfiguration
3
+ class MetadataLoader
4
+ EMPTY_VERSION = '0.0.0'
5
+
6
+ # @param [String] setting_path
7
+ # @return [MetadataLoader]
8
+ def self.load(setting_path: )
9
+ self.new(setting_path)
10
+ end
11
+
12
+ # @param [String] setting_path
13
+ def initialize(setting_path)
14
+ content = File.read(setting_path)
15
+ if(matched = content.match(/metadata-required_pbm_version: ([\d.]+)/))
16
+ @required_pbm_version = matched[1]
17
+ end
18
+ end
19
+
20
+ # @return [String]
21
+ def required_pbm_version
22
+ return EMPTY_VERSION unless defined?(@required_pbm_version)
23
+ return @required_pbm_version if @required_pbm_version
24
+ end
25
+ end
26
+ end
27
+ end
@@ -12,7 +12,7 @@ module ProconBypassMan
12
12
  def valid?
13
13
  @errors = Hash.new {|h,k| h[k] = [] }
14
14
 
15
- validate_require_prefix_keys
15
+ warn_blank_prefix_keys
16
16
  validate_config_of_button_lonely
17
17
  validate_verify_button_existence
18
18
  validate_flip_and_remap_are_hate_each_other
@@ -56,10 +56,10 @@ module ProconBypassMan
56
56
  end
57
57
  end
58
58
 
59
- def validate_require_prefix_keys
59
+ # @return [void]
60
+ def warn_blank_prefix_keys
60
61
  if @prefix_keys.empty?
61
- @errors[:prefix_keys] ||= []
62
- @errors[:prefix_keys] << "prefix_keys_for_changing_layerに値が入っていません。"
62
+ ProconBypassMan.logger.warn "prefix_keys_for_changing_layerに値が入っていません。"
63
63
  end
64
64
  end
65
65
 
@@ -65,8 +65,8 @@ class ProconBypassMan::BypassCommand
65
65
  process.work
66
66
 
67
67
  process_switching_time_before_work = BlueGreenProcess.performance.process_switching_time_before_work
68
- if process_switching_time_before_work > 0.1
69
- ProconBypassMan::PrintMessageCommand.execute(text: "slow process_switching_time_before_work: #{process_switching_time_before_work}")
68
+ if process_switching_time_before_work > 0.2
69
+ ProconBypassMan::SendWarningCommand.execute(warning: "[PERFORMANCE] BlueGreenProcess.performance.process_switching_time_before_work: #{process_switching_time_before_work}", stdout: false)
70
70
  end
71
71
 
72
72
  rescue EOFError => e
@@ -0,0 +1,18 @@
1
+ class ProconBypassMan::SendWarningCommand
2
+ # @param [String, Hash, Exception] warning
3
+ # @return [void]
4
+ def self.execute(warning: , stdout: true)
5
+ body =
6
+ case warning
7
+ when String, Hash
8
+ warning
9
+ else
10
+ warning.full_message
11
+ end
12
+
13
+ ProconBypassMan.logger.warn body
14
+ puts body if stdout
15
+
16
+ ProconBypassMan::ReportWarningJob.perform(warning)
17
+ end
18
+ end
@@ -4,3 +4,4 @@ require "procon_bypass_man/commands/write_session_id_command"
4
4
  require "procon_bypass_man/commands/write_device_id_command"
5
5
  require "procon_bypass_man/commands/send_reload_config_event_command"
6
6
  require "procon_bypass_man/commands/send_error_command"
7
+ require "procon_bypass_man/commands/send_warning_command"
@@ -9,6 +9,7 @@ module ProconBypassMan
9
9
  Pbmenv.uninstall(pbm_version) # 途中でシャットダウンしてしまった、とか状態が途中の状態かもしれないので一旦消す
10
10
  Pbmenv.install(pbm_version, enable_pbm_cloud: true)
11
11
  Pbmenv.use(pbm_version)
12
+ Pbmenv.clean(10)
12
13
  ProconBypassMan.logger.info "#{pbm_version}へアップグレードしました"
13
14
  ProconBypassMan::ReportCompletedUpgradePbmJob.perform
14
15
  `reboot` # symlinkの参照先が変わるのでrebootする必要がある
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
- spec.add_dependency "pbmenv", ">= 0.1.9" # enable_pbm_cloud連携機能でPbmenv.installを使っている.
31
+ spec.add_dependency "pbmenv", ">= 0.1.11" # enable_pbm_cloud連携機能でPbmenv.install, .cleanを使っている.
32
32
  spec.add_dependency "action_cable_client"
33
33
  spec.add_dependency "sorted_set"
34
34
  spec.add_dependency "blue_green_process", '0.1.4.2'
@@ -12,7 +12,7 @@ begin
12
12
  gemfile do
13
13
  source 'https://rubygems.org'
14
14
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
15
- gem 'procon_bypass_man', '0.3.4'
15
+ gem 'procon_bypass_man', '0.3.5'
16
16
  end
17
17
  rescue Bundler::Source::Git::GitCommandError => e
18
18
  retry_count_on_git_command_error = retry_count_on_git_command_error + 1
@@ -12,7 +12,7 @@ begin
12
12
  gemfile do
13
13
  source 'https://rubygems.org'
14
14
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
15
- gem 'procon_bypass_man', '0.3.4'
15
+ gem 'procon_bypass_man', '0.3.5'
16
16
  end
17
17
  rescue Bundler::Source::Git::GitCommandError => e
18
18
  retry_count_on_git_command_error = retry_count_on_git_command_error + 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procon_bypass_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-26 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pbmenv
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.9
19
+ version: 0.1.11
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.9
26
+ version: 0.1.11
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: action_cable_client
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ files:
106
106
  - docs/setting/splatoon3_macro_dasei_cancel.md
107
107
  - docs/setting/splatoon3_macro_forward_ikarole.md
108
108
  - docs/setting/splatoon3_recommended_setting.md
109
- - docs/setting/splatoon3_rotation_forward_stick.md
109
+ - docs/setting/splatoon3_rotation_left_stick.md
110
110
  - docs/setup_raspi.md
111
111
  - docs/setup_raspi.mitamae.rb
112
112
  - docs/setup_raspi_by_mitamae.md
@@ -129,10 +129,12 @@ files:
129
129
  - lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
130
130
  - lib/procon_bypass_man/background/jobs/report_reload_config_job.rb
131
131
  - lib/procon_bypass_man/background/jobs/report_start_reboot_job.rb
132
+ - lib/procon_bypass_man/background/jobs/report_warning_job.rb
132
133
  - lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb
133
134
  - lib/procon_bypass_man/buttons_setting_configuration.rb
134
135
  - lib/procon_bypass_man/buttons_setting_configuration/layer.rb
135
136
  - lib/procon_bypass_man/buttons_setting_configuration/loader.rb
137
+ - lib/procon_bypass_man/buttons_setting_configuration/metadata_loader.rb
136
138
  - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer.rb
137
139
  - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button.rb
138
140
  - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb
@@ -153,6 +155,7 @@ files:
153
155
  - lib/procon_bypass_man/commands/print_message_command.rb
154
156
  - lib/procon_bypass_man/commands/send_error_command.rb
155
157
  - lib/procon_bypass_man/commands/send_reload_config_event_command.rb
158
+ - lib/procon_bypass_man/commands/send_warning_command.rb
156
159
  - lib/procon_bypass_man/commands/write_device_id_command.rb
157
160
  - lib/procon_bypass_man/commands/write_session_id_command.rb
158
161
  - lib/procon_bypass_man/configuration.rb