jef-sure/board-setup

0.0.1

Latest
uploaded 4 hours ago
Wi-Fi from a phone and the time from the network, for a program of ESP-IDF

Readme

# board-setup

Wi-Fi from a phone and the time from the network, for a program of ESP-IDF.
[По-русски](README-ru.md)

A device that keeps no network shows a QR code on its display. The application ESP BLE Provisioning of Espressif (Google
Play, App Store) reads it, and the phone gives the device a network over BLE. The device keeps the network, restarts and
runs the program: connected in the background, its clock set from a time server. Bluetooth works only during the setup,
so the program has its memory.

This is the first version: the network and the time, nothing else. It is built for the chips and the versions of ESP-IDF
that CHANGES.md lists; it has not been run on a board yet.

## Use

```yaml
# main/idf_component.yml
dependencies:
  jef-sure/board-setup: "^0.0.1"
```

```c
#include "board_setup.h"

void app_main(void)
{
    setenv("TZ", "CET-1CEST,M3.5.0,M10.5.0/3", 1);
    tzset();
    /* the display and its touch are started before */
    board_setup_start(&(board_setup_t){.name = "CLOCK", .pop = "morphing", .screen = screen});
    /* the program: there may be no connection yet, board_setup_connected() and board_setup_has_time() say */
}
```

- `name` gives the device its names by the last three bytes of its MAC address: `CLOCK-A1B2C3` over BLE, `clock-a1b2c3`
  in the network.
- `pop` is the proof of possession. The QR code carries it, so it is no secret: it pairs the phone with this device.
- `screen` is a `dgx_screen_t *` of [jef-sure/dgx](https://components.espressif.com/components/jef-sure/dgx), which the
  component brings. NULL: no picture, and the device is chosen in the application by its name, with the proof of
  possession typed.
- The setup waits for the phone without a limit. A wrong password is shown, and the phone may send another network.
- The time zone is the program's: `TZ`, as above.

`board_setup_start()` returns false when the radio or the setup does not start; the log names the call that failed.

## Configuration

In `sdkconfig.defaults` of the program:

```
# NimBLE takes less flash and RAM than Bluedroid, which ESP-IDF takes unless told
CONFIG_BT_NIMBLE_ENABLED=y
# Wi-Fi and Bluetooth do not fit into the 1 MB of the default partition table
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
```

Bluetooth and security 1 of the setup are turned on by the component. `CONFIG_BOARD_SETUP_QR_IN_LOG=y` prints the QR code
to the console as well, for debugging; it is off by default.

## Limits

- The chip needs Wi-Fi and BLE: ESP32-S2 (no BLE) and ESP32-P4 (no radio of its own) are not served.
- Another network: `idf.py erase-flash`, and the setup comes again. There is no call for it yet.
- On the computer (the linux target of ESP-IDF) there is nothing to set up: `board_setup_start()` returns true at once.

## License

MIT. `src/qrcodegen/` is the QR Code generator library of Project Nayuki 1.8.0, MIT, its notice in the files.

Links

To add this component to your project, run:

idf.py add-dependency "jef-sure/board-setup^0.0.1"

download archive

Stats

  • Archive size
    Archive size ~ 30.39 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

jef-sure/board-setup version: 0.0.1
|