Smart Citizen Kit 2.0 firmware
Clone or download

README.md

Smart Citizen Kit 2.0 Travis

PRs Welcome

Smart Citizen kit 2.0

You can see this repos current (master branch) state of the mobile UI setup here:

https://fablabbcn.github.io/smartcitizen-kit-20/esp/data/

Development

The app consists of 3 things

  • The core firmware (C++)
  • Frontend, a mobile web UI for setting up the kit. localhost:8000
  • mock-api - for mocking the API of the kit localhost:3000

All branches and pull requests on Github are auto tested with Travis

The core firmware (C++)

The technology used:

  • Platformio

Uploading the firmware to the kit

After clonning the repository:

  1. In folder ./sam/ do:
  • pio run

    This step will take a while and end with an error because a bug... don't worry go to next step)

  • pio run -t upload

  1. in folder ./esp/ do:
  • pio run -t upload
  1. To upload the Frontend website code to the filesystem do:
  • pio run -t uploadfs

SCK Shell

The SCK provides a comprehensive command shell over USB to manage all the kits functionalities for advanced users.

Use any Serial console as screen, platformio device monitor, or the serial monitor on the Arduino IDE

Example commands:


SCK> help

SCK> config -wifi "myWifiName" "myPassword" -token myToken -mode network

Frontend + api setup

The technology used here is:

  • HTML, CSS, JavaScript
  • (Vue.js)
  • ** Make sure it is using the old javascript, so older phones work. **

And the files are under esp/data

Starting frontend development

Inside the ./mock-api folder do:

  1. npm install

  2. npm run web - Starts frontend on localhost:8000

  3. npm run api - Starts api on localhost:3000

  4. gulp watch - Watches changes and creates 2 files automatically; final.html and index.gz

Now you can start editing esp/data/index.html

If your mock-api is not responding, see /esp/data/main.js, theUrl should be (your API url:port)

Testing frontend

You can run End to End test (for the Web UI) against the current master branch with this command:

npm test

If you want the tests to be run automatically everytime you edit mock-api/casperjs/test use:

npm run autotest

Edit tests under mock-api/casperjs/test

TODO / ideas:

  • Should we move the frontend to /mock-api, and create a process which compiles it + concatinates and puts the 'dist' in esp/data?

Documentation

Full documentation under development. Follow the forum and twitter for updates.

Related Smart Citizen repositories

License

All the software unless stated is released under GNU GPL v3.0 and the hardware design files under CERN OHL v1.2

Funding

This work has received funding from the European Union's Horizon 2020 research and innovation program under the grant agreement No. 689954