バナーナナブログ

宮城県仙台市より、日々思ったことを綴っていくウェブログです。

BacklogチケットのコメントをAPIを使って追加する(Python2/Python3)

ピオニーとバドレックスの掛け合い、ウッチャン空気階段あたりを好きなスタッフいるんかな?と思った。

f:id:smdbanana:20201027232728j:plain


さて。
最近Backlogを利用されるお客様が多いように感じます。
サーバの状況etcをBacklogの特定チケットにcronで集約すると便利だなーと思い、
APIを利用してBacklogのチケットにコメントを自動送信してみました。

続きを読む

AWSのEC2にEC-CUBEをインストールする

はじめに

コロナウィルスの影響により、イベント開催が難しくなっているのでECを活用したいという話を聞く機会が増えた。
営業支援をともに行っているAくんは非エンジニアだが、自己学習のためAWSを触ってみたりしているので、
彼が自分でEC-CUBEを設定できるよう最速で簡単にセットアップするための手順を用意してみた。

TL;DR

  • 2020-08-24 記事作成
  • Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-0cc75a8978fbbc969 使用
  • EC-CUBE 4.0.4 使用

AWSのEC2にEC-CUBEをインストールする

上の補足説明

yumのupdate

yum update -y 

LAMP環境の用意

amazon-linux-extras install -y lamp-mariadb10.2-php7.2
yum install -y mariadb-server
yum install -y httpd php php-xml php-mbstring php-zip php-intl

https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html
ここに詳しく書いていますが、amazon-linux-extrasコマンドでパッケージを最新化し
yumコマンドで必要パッケージをインストールするという流れです。

php-xmlなどは入れておかないとEC-CUBEのインストールステップの中で怒られます。 

EC-CUBEファイル群の設置

cd /usr/local/src/
wget http://downloads.ec-cube.net/src/eccube-4.0.4.zip
unzip eccube-4.0.4.zip
mv eccube-4.0.4 /var/www/html/ec
chown -R apache:apache /var/www/html/

wgetでzipをダウンロードし、解答したら
/var/www/html/ec
に設置、apacheユーザ権限を付与してやる。

Apacheの設定

echo -e '<Directory "/var/www/html/ec">\n AllowOverride All\n</Directory>' > /etc/httpd/conf.d/ec.conf

専用confを設定せずそのままインストールを進めると、リダイレクトでエラーになります。
これはEC-CUBE.htaccessを利用してrewrite処理をしようとするけど
/var/www/html 以下はAllowOverride Noneなのでその配下の.htaccessが効かないためです。
/var/www/html/ec 以下はAllowOverride Allという設定を入れておきます。 

MariaDBの設定

systemctl start mariadb
mysql -u root -e "CREATE DATABASE ecdb DEFAULT CHARACTER SET utf8;CREATE USER 'ecuser'@'localhost' IDENTIFIED BY 'ecpass';GRANT ALL PRIVILEGES ON ecdb.* TO 'ecuser'@'localhost';FLUSH PRIVILEGES;"

mariadbを起動して、データベースの作成とユーザの設定を実行します。
SQLの内容を1行ずつ切り分けるとこんな感じ。

// データベースを作成する。データベース名は「ecdb」としておく。
CREATE DATABASE ecdb DEFAULT CHARACTER SET utf8;
// ユーザの作成。ユーザ名「ecuser」、パスワード「ecpass」としておく。
CREATE USER 'ecuser'@'localhost' IDENTIFIED BY 'ecpass';
// 権限変更。全て許可する。
GRANT ALL PRIVILEGES ON ecdb.* TO 'ecuser'@'localhost';
// 権限テーブルを変更したのでそれを知らせる
FLUSH PRIVILEGES;

データベース名やユーザ名、パスワード等は適宜変更してください。

Apacheの起動

systemctl start httpd

最後にApacheを起動。

以上でサーバ側のセットアップは完了。

 

WEB側のセットアップ

サーバ側のセットアップが終わったら、今度はWEB側のセットアップを行う。

セットアップ STEP1

f:id:smdbanana:20200824131154p:plain

/ec にアクセスすると、install/step1 にリダイレクトされます。
.htaccessが無効な場合はここで403になるし、必要なモジュールが入ってないとここで怒られます。

セットアップ STEP2

f:id:smdbanana:20200824131209p:plain

アクセス権限を確認されます。

セットアップ STEP3

f:id:smdbanana:20200824131221p:plain

必要に応じてサイトの設定を行います。
管理画面のディレクトリ名は推測されづらいものを入れた方が良いし、
完全ssl化や管理画面へのIP制限は行っていた方が安全です。

セットアップ STEP4

f:id:smdbanana:20200824131234p:plain

DBの設定です。
サーバ側設定で利用したものを入力します。
また、必須事項になっていませんがホスト名は必須(localhostだからスキップでいいだろ、としていたらエラーになりました。)のようです。

セットアップ STEP5

f:id:smdbanana:20200824131248p:plain

初期化を行います。

セットアップ STEP6

f:id:smdbanana:20200824131301p:plain

問題なければインストール完了の画面が表示されます。
「管理画面を表示」を押下します。

管理画面へのログイン

f:id:smdbanana:20200824131314p:plain

STEP3で設定したログイン情報を使ってログインします。
成功すれば管理画面内にアクセスできます。

f:id:smdbanana:20200824131331p:plain

 

以上!

ポケモン剣盾で努力値振り分け自動化

今回もポケモンの話。

ソードシールドからドーピングアイテムによる努力値上昇の上限が100→252、
つまりフル投与できるようになりました。
(公式にはきそポイントって呼んでいますが、私には努力値呼称の方が付き合いが長いのでそう呼びます。)
ぶっぱだけなら問題ないんですが、細かい調整を対応しようとすると野生ポケモンと戦闘したり羽を与えたりする必要があります。
ドーピングアイテム投与にはお金がかかる…
野生ポケモンは遭遇する場所まで行かないといけない…
羽は回収が面倒…

もう一つ、努力値を振る方法があります。
そう。
ポケジョブです。

1時間につき4の努力値を与えます。

  • Hに振る … 体力ゼミ開校中!
  • Aに振る … こうげきゼミ開校中!
  • Bに振る … ぼうぎょゼミ開校中!
  • Cに振る … とくこうゼミ開校中!
  • Dに振る … とくぼうゼミ開校中!
  • Sに振る … すばやさゼミ開校中!

お出かけする時間がいくつか用意されており、最大の1日後であれば努力値に96振られます。

選択肢 時間 獲得努力値
一日 24時間 96
半日 12時間 48
かなり長め 08時間 32
長め 04時間 16
短め 03時間 12
かなり短め 02時間 08
ほんの少し 01時間 04

デメリットは「時間がかかる」。

ただ、システムの抜け穴を使ってこの時間をコントロールすることができます。
俗に言う「時渡り」「新・時渡り」というやつです。
(時渡りについては本記事では取り扱いませんし自己責任です。)

新・時渡りを使ったら一日が数秒で「経過したこと」にできるので、これを利用した自動化プログラムを作りました。

ちなみに、自動化プログラムについては過去のこちらの記事を参照↓
smdbanana.hatenablog.com

今回作成したプログラムはGithubに公開しています。

github.com

Modules/GiveEffort.c
こいつが今回作ったプログラム部分になります。

README_ja.md にも書いていますが、使い方はこんな感じ。

努力値振り分け自動化

ビルド方法

以下を実行

$ make give-effort EFFORT_H=0 EFFORT_A=0 EFFORT_B=44 EFFORT_C=212 EFFORT_D=0 EFFORT_S=252

// 0は省略しても大丈夫です↓こんなのもok
// $ make give-effort EFFORT_B=44 EFFORT_C=212 EFFORT_S=252

使い方

※ 新時渡り(レイドバトルによる日付変更ペナルティの回避)を利用した自動化です。利用する場合は自己責任でお願いします。

  1. 新時渡りによりペナルティ回避状態にしてください。
  2. 何月でもいいので1日にしてください。
  3. 何時でもいいので0分にしてください。
  4. 設定で「話の速さ」を速いにしてください。
  5. 左上のポケモンボックスに対象ポケモン1匹だけを配置してください。
  6. ロトミの前まで移動してください。
  7. Arduino UNO R3 と Nintendo Switch を接続してください。
  8. H→A→B→C→D→S の順に努力値を振っていきます。(510の範囲チェックとかはやってないので自己責任で)

※ 新・時渡りを使い、1日と2分後に進みます。そのため1日の0分を基準時間にしてもらいたいのです。

作ったプログラムを書き込んでみます。
(今回はMACの環境を使って、ウッウにB44/C212/S252振るための設定を書き込んでいます。)

$ make clean
makefile:80: warning: overriding commands for target `clean'
lufa/LUFA/Build/DMBS/DMBS/gcc.mk:193: warning: ignoring old commands for target `clean'
 [RM]      : Removing object files of "HatchEggs_1_box"
rm -f obj/Joystick.o obj/Descriptors.o obj/HIDParser.o obj/Device_AVR8.o obj/EndpointStream_AVR8.o obj/Endpoint_AVR8.o obj/Host_AVR8.o obj/PipeStream_AVR8.o obj/Pipe_AVR8.o obj/USBController_AVR8.o obj/USBInterrupt_AVR8.o obj/ConfigDescriptors.o obj/DeviceStandardReq.o obj/Events.o obj/HostStandardReq.o obj/USBTask.o obj/CommonModule.o obj/GiveEffort.o obj/HatchEggs.o obj/LoopBattleTower.o obj/LoopTournament.o obj/MagicalTrade.o obj/OnlyHatchEggs.o obj/PokeJob.o obj/ReleasePokemons.o obj/RepeatA.o
 [RM]      : Removing dependency files of "HatchEggs_1_box"
rm -f obj/Joystick.d obj/Descriptors.d obj/HIDParser.d obj/Device_AVR8.d obj/EndpointStream_AVR8.d obj/Endpoint_AVR8.d obj/Host_AVR8.d obj/PipeStream_AVR8.d obj/Pipe_AVR8.d obj/USBController_AVR8.d obj/USBInterrupt_AVR8.d obj/ConfigDescriptors.d obj/DeviceStandardReq.d obj/Events.d obj/HostStandardReq.d obj/USBTask.d obj/CommonModule.d obj/GiveEffort.d obj/HatchEggs.d obj/LoopBattleTower.d obj/LoopTournament.d obj/MagicalTrade.d obj/OnlyHatchEggs.d obj/PokeJob.d obj/ReleasePokemons.d obj/RepeatA.d
rm -f *.bin *.eep *.elf *.hex *.lss *.map *.sym
$ make give-effort EFFORT_B=44 EFFORT_C=212 EFFORT_S=252
makefile:80: warning: overriding commands for target `clean'
lufa/LUFA/Build/DMBS/DMBS/gcc.mk:193: warning: ignoring old commands for target `clean'
/Library/Developer/CommandLineTools/usr/bin/make TARGET=GiveEffort APPEND_CC_FLAGS='-DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252'
makefile:80: warning: overriding commands for target `clean'
lufa/LUFA/Build/DMBS/DMBS/gcc.mk:193: warning: ignoring old commands for target `clean'
 [INFO]    : Begin compilation of project "GiveEffort"...

avr-gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 [GCC]     : Compiling C file "Joystick.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Joystick.d Joystick.c -o obj/Joystick.o
 [GCC]     : Compiling C file "Descriptors.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Descriptors.d Descriptors.c -o obj/Descriptors.o
 [GCC]     : Compiling C file "HIDParser.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/HIDParser.d ./lufa/LUFA/Drivers/USB/Class/Common/HIDParser.c -o obj/HIDParser.o
 [GCC]     : Compiling C file "Device_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Device_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c -o obj/Device_AVR8.o
 [GCC]     : Compiling C file "EndpointStream_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/EndpointStream_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c -o obj/EndpointStream_AVR8.o
 [GCC]     : Compiling C file "Endpoint_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Endpoint_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c -o obj/Endpoint_AVR8.o
 [GCC]     : Compiling C file "Host_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Host_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c -o obj/Host_AVR8.o
 [GCC]     : Compiling C file "PipeStream_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/PipeStream_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c -o obj/PipeStream_AVR8.o
 [GCC]     : Compiling C file "Pipe_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Pipe_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c -o obj/Pipe_AVR8.o
 [GCC]     : Compiling C file "USBController_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/USBController_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c -o obj/USBController_AVR8.o
 [GCC]     : Compiling C file "USBInterrupt_AVR8.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/USBInterrupt_AVR8.d ./lufa/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c -o obj/USBInterrupt_AVR8.o
 [GCC]     : Compiling C file "ConfigDescriptors.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/ConfigDescriptors.d ./lufa/LUFA/Drivers/USB/Core/ConfigDescriptors.c -o obj/ConfigDescriptors.o
 [GCC]     : Compiling C file "DeviceStandardReq.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/DeviceStandardReq.d ./lufa/LUFA/Drivers/USB/Core/DeviceStandardReq.c -o obj/DeviceStandardReq.o
 [GCC]     : Compiling C file "Events.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/Events.d ./lufa/LUFA/Drivers/USB/Core/Events.c -o obj/Events.o
 [GCC]     : Compiling C file "HostStandardReq.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/HostStandardReq.d ./lufa/LUFA/Drivers/USB/Core/HostStandardReq.c -o obj/HostStandardReq.o
 [GCC]     : Compiling C file "USBTask.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/USBTask.d ./lufa/LUFA/Drivers/USB/Core/USBTask.c -o obj/USBTask.o
 [GCC]     : Compiling C file "CommonModule.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/CommonModule.d Modules/CommonModule.c -o obj/CommonModule.o
 [GCC]     : Compiling C file "GiveEffort.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/GiveEffort.d Modules/GiveEffort.c -o obj/GiveEffort.o
 [GCC]     : Compiling C file "HatchEggs.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/HatchEggs.d Modules/HatchEggs.c -o obj/HatchEggs.o
 [GCC]     : Compiling C file "LoopBattleTower.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/LoopBattleTower.d Modules/LoopBattleTower.c -o obj/LoopBattleTower.o
 [GCC]     : Compiling C file "LoopTournament.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/LoopTournament.d Modules/LoopTournament.c -o obj/LoopTournament.o
 [GCC]     : Compiling C file "MagicalTrade.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/MagicalTrade.d Modules/MagicalTrade.c -o obj/MagicalTrade.o
 [GCC]     : Compiling C file "OnlyHatchEggs.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/OnlyHatchEggs.d Modules/OnlyHatchEggs.c -o obj/OnlyHatchEggs.o
 [GCC]     : Compiling C file "PokeJob.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/PokeJob.d Modules/PokeJob.c -o obj/PokeJob.o
 [GCC]     : Compiling C file "ReleasePokemons.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/ReleasePokemons.d Modules/ReleasePokemons.c -o obj/ReleasePokemons.o
 [GCC]     : Compiling C file "RepeatA.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega16u2 -fshort-enums -fno-inline-small-functions -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DGIVE_EFFORT -DEFFORT_H=0 -DEFFORT_A=0 -DEFFORT_B=44 -DEFFORT_C=212 -DEFFORT_D=0 -DEFFORT_S=252  -I. -I./lufa/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL   -MMD -MP -MF obj/RepeatA.d Modules/RepeatA.c -o obj/RepeatA.o
 [LNK]     : Linking object files into "GiveEffort.elf"
avr-gcc obj/Joystick.o obj/Descriptors.o obj/HIDParser.o obj/Device_AVR8.o obj/EndpointStream_AVR8.o obj/Endpoint_AVR8.o obj/Host_AVR8.o obj/PipeStream_AVR8.o obj/Pipe_AVR8.o obj/USBController_AVR8.o obj/USBInterrupt_AVR8.o obj/ConfigDescriptors.o obj/DeviceStandardReq.o obj/Events.o obj/HostStandardReq.o obj/USBTask.o obj/CommonModule.o obj/GiveEffort.o obj/HatchEggs.o obj/LoopBattleTower.o obj/LoopTournament.o obj/MagicalTrade.o obj/OnlyHatchEggs.o obj/PokeJob.o obj/ReleasePokemons.o obj/RepeatA.o -o GiveEffort.elf -lm -Wl,-Map=GiveEffort.map,--cref -Wl,--gc-sections -Wl,--relax -mmcu=atmega16u2
 [OBJCPY]  : Extracting HEX file data from "GiveEffort.elf"
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature GiveEffort.elf GiveEffort.hex
 [OBJCPY]  : Extracting EEP file data from "GiveEffort.elf"
avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings GiveEffort.elf GiveEffort.eep || exit 0
 [OBJCPY]  : Extracting BIN file data from "GiveEffort.elf"
avr-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature GiveEffort.elf GiveEffort.bin
 [OBJDMP]  : Extracting LSS file data from "GiveEffort.elf"
avr-objdump -h -d -S -z GiveEffort.elf > GiveEffort.lss
 [NM]      : Extracting SYM file data from "GiveEffort.elf"
avr-nm -n GiveEffort.elf > GiveEffort.sym
 [SIZE]    : Determining size of "GiveEffort.elf"

avr-size --mcu=atmega16u2 --format=avr GiveEffort.elf
AVR Memory Usage
----------------
Device: atmega16u2

Program:    5114 bytes (31.2% Full)
(.text + .data + .bootloader)

Data:        199 bytes (38.9% Full)
(.data + .bss + .noinit)


 [INFO]    : Finished building project "GiveEffort".
$ dfu-programmer atmega16u2 erase
Checking memory from 0x0 to 0x2FFF...  Not blank at 0x1.
Erasing flash...  Success
$ dfu-programmer atmega16u2 flash GiveEffort.hex
Checking memory from 0x0 to 0x13FF...  Empty.
0%                            100%  Programming 0x1400 bytes...
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
0%                            100%  Reading 0x3000 bytes...
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
Validating...  Success
0x1400 bytes written into 0x3000 bytes memory (41.67%).

Arduinoに書き込み終わったら、USB接続!

f:id:smdbanana:20200308162748j:plain

ポケ徹さんとかのサイトで努力値がちゃんと振り分けられているか確認したら完了!