stack-chan icon indicating copy to clipboard operation
stack-chan copied to clipboard

How to connect to WiFi and use the features (Expressions/Text2Speech)? HTTP API?

Open SteveJos opened this issue 4 years ago • 1 comments

Hey @meganetaaan !

Although I googled my fingers off, I did not manage to connect the stack-chan to my WiFi. I looked also at the code (searched for SSID) but you created a really complex project that is a little bit hard to understand.

Dont get me wrong, I really like your project and would like to use and contribute to it....but it is lacking a guide on how to get started with extending or customizing the SW.

Thank you in advance for helping!

SteveJos avatar Dec 21 '21 16:12 SteveJos

Yeah so few things documented... Current implementation needs two steps to connect WiFi.

  1. write down ssid and password settings to your manifest_local.json
{
    "config": {
        "ssid": "your_ssid_here", // Note that the M5Stack can only connect to WiFi in the 2.4GHz band!
        "password": "your_password_here",
        "tts": {...},
        "servo": {...}
    }
}
  1. call initNetwork function explicitly and use API inside its callback

An example using this function: https://github.com/meganetaaan/stack-chan/blob/0f94cdfe8d3133fb8304153465551bc9b1c4255c/firmware/mods/cheerup/mod.js#L114

import initNetwork from 'init-network'
// ...
initNetwork(() => {
  callSomeAPI()
}

You can use any kind of network module like HTTP Server/Client as documented in the ModdableSDK repository.

I will update documentations of firmware. I think forcing users to call initNetwork explicitly is annoying. So I'm planning to make API smarter.

meganetaaan avatar Jan 02 '22 16:01 meganetaaan