Code Monkey home page Code Monkey logo

webconfigurator's Introduction

GP2040 Web Configurator

Simple web application for gamepad configuration.

Requirements

  • NodeJS and NPM to build the React app

Development

Navigate to the www folder and run npm run dev. This will start up the React app and an Express instance for mock data during development, allowing testing of the configurator without loading it onto the MCU, which is a SLOW process.

The mock data Express server is running at http://localhost:8080.

API Endpoints

When adding a new API endpoint to the GP2040 Configurator:

NOTE: All endpoints should be under the /api path

  • Add the endpoint to src/webserver.cpp.
    • Add a define at the top: #define API_GET_NEW_ENDPOINT "/api/getNewEndpoint"
      • Use the naming convention API_[GET/SET]_{ENDPOINT_PATH} for the define
      • Use the naming convention /api/{[get/set]EndpointPath} for the path
    • Create the backing method with the same name as the API path: string getNewEndpoint()
    • Add handling code in fs_open_custom for the API path
  • Add a mock data endpoint to src/server/app.js
  • Add the client-side API function to www/src/Services/WebApi.js.
  • Add the endpoint to the Postman collection at www/server/docs/GP2040.postman_collection.json

Files

Use JPG and PNG files for images, SVG file support requires modification to the lwIP library that hasn't been completed.

Building

If you just want to rebuild the React app in production mode for some reason, you can run npm run build from the www folder.

The makedatafs.js script is used to build the React application and regenerate the embedded data in lib/httpd/fsdata.c. The makefsdata tool that performs the conversion doesn't set the correct #include lines for our use. This script will fix this issue.

Precompiled binaries of makedatafs for Windows, Linux and macOS are included in the tools folder.

References

Original example:

Convert text to bytes:

Create image map:

webconfigurator's People

Contributors

arntsonl avatar caian avatar deeebug avatar feralai avatar fortinbra avatar mikepparks avatar pelsin avatar rafaelcruzpb avatar thetraingoes avatar thnikk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.