Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
72def39d3This file is pinned to the selected release. Download the original to open it in your design tool.
# スタックチャン ファームウェア
## 注意
* ファームウェアは現在も積極的に開発中です。内部の作りやAPIが大きく変わる可能性があります。
* 「Moddableの環境構築の手順が多くて大変」という課題に対して、現在[issue](https://github.com/meganetaaan/stack-chan/issues/65)を立てて対応中です。環境構築でつまづいた方はフィードバックをぜひお寄せください。
* Arduino IDEになじみのある方は @mongonta0716 さんの[stack-chan-tester](https://github.com/mongonta0716/stack-chan-tester)もお試しください(PWMサーボのみ対応)。
## 開発に必要なもの
* ホストPC
* Linux(Ubuntu20.04)でテスト済み
* M5Stack Basic
* USB type-Cケーブル
* [ModdableSDK](https://github.com/Moddable-OpenSource/moddable)
* [Getting Started Doc](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/Moddable%20SDK%20-%20Getting%20Started.md)を参照
* Node.js
### (オプション) Dockerイメージを使う
このリポジトリはDockerfileによるビルド環境を提供しています。
Dockerコンテナの中でファームウェアのビルド、書き込みとデバッグが可能です。
本READMEの[インストラクション](#optional-build-and-launch-docker-container)を参照ください。
## ファームウェアのビルドと書き込み
### リポジトリをサブモジュールと一緒にクローンする
```
git clone --recursive https://github.com/meganetaaan/stack-chan.git
cd stack-chan/firmware
```
### (オプション) Dockerコンテナのビルドと起動
#### ターミナルを使う場合
```
$user@host# ./build-container.sh
$user@host# ./launch-container.sh
$root@container# npm install
```
#### VSCode Development Container (devcontainer)を使う場合
* コマンドパレットを開く
* `>Remote-Containers: Reopen in Container`を実行する
### スタックチャンをホストPCと接続する

### ビルドと書き込み(デバッグ機能を使わない場合)
```sh
# M5Stack Basic/Gray/Fireの場合
npm run deploy
# M5Stack CORE2の場合
npm run deploy:m5stack_core2
```
### ビルドと書き込み(デバッグする場合)
```sh
# M5Stack Basic/Gray/Fireの場合
npm run debug
# M5Stack CORE2の場合
npm run debug:m5stack_core2
```
このコマンドはデバッグ用にビルドしたファームウェアを書き込むと同時に、ModdableSDKのデバッガである`xsbug`を起動します。
詳しくは[xsbug(公式ドキュメント)](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/xsbug.md)を参照してください。
## API
### TTS(音声合成)
[text-to-speech.md](./docs/text-to-speech.md)を参照(英語)。