Skip to content

Commit

Permalink
Revert "Dev board mode (OpenStickCommunity#494)"
Browse files Browse the repository at this point in the history
This reverts commit 25d8288.
  • Loading branch information
Kadoyu committed Sep 19, 2023
1 parent 7e40dc6 commit cffb11f
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 57 deletions.
1 change: 0 additions & 1 deletion src/configs/webconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ int set_file_data(fs_file* file, const DataAndStatusCode& dataAndStatusCode)
returnData.append(
"Server: GP2040-CE " GP2040VERSION "\r\n"
"Content-Type: application/json\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Content-Length: "
);
returnData.append(std::to_string(dataAndStatusCode.data.length()));
Expand Down
1 change: 0 additions & 1 deletion www/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VITE_CURRENT_VERSION=v0.7.4
VITE_GP2040_BOARD=pico
VITE_GP2040_CONTROLLER=pico
VITE_DEV_BASE_URL=http://localhost:8080
9 changes: 1 addition & 8 deletions www/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ Simple web application for gamepad configuration.

## Development

### Mocked board

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.
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.

### Connected board

Run `npm run dev-board`. This will start up the React app and try connect to the board running the
[web-configurator](https://gp2040-ce.info/#/web-configurator).

### API Endpoints

When adding a new API endpoint to the GP2040-CE Configurator:
Expand Down
12 changes: 0 additions & 12 deletions www/env.d.ts

This file was deleted.

26 changes: 0 additions & 26 deletions www/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@
"build": "vite build && npm run makefsdata",
"dev-server": "nodemon -r dotenv/config ./server/app.js",
"dev": "concurrently --kill-others \"npm run dev-server\" \"npm start\"",
"dev-board": "cross-env VITE_DEV_BASE_URL=http://192.168.7.1 npm start ",
"format": "prettier --write \"{src,server}/**/*.{tsx,ts,jsx,js,json,scss}\"",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"makefsdata": "node makefsdata.js",
"start": "vite"
},
"devDependencies": {
"@types/node": "^20.5.9",
"@vitejs/plugin-react": "^4.0.0",
"concurrently": "^8.0.1",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"dotenv": "^16.1.4",
"eslint": "^8.38.0",
"eslint-plugin-i18next": "^6.0.3",
Expand Down
11 changes: 5 additions & 6 deletions www/src/Services/WebApi.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import axios from 'axios';
import { hexToInt, rgbIntToHex } from './Utilities';
import { intToHex, hexToInt, rgbIntToHex } from './Utilities';

const baseUrl =
process.env.NODE_ENV === 'production'
? ''
: import.meta.env.VITE_DEV_BASE_URL;
process.env.NODE_ENV === 'production' ? '' : 'http://localhost:8080';

export const baseButtonMappings = {
Up: { pin: -1, key: 0, error: null },
Expand Down Expand Up @@ -579,13 +577,14 @@ async function getHeldPins(setLoading, createAbortSignal) {

try {
const response = await axios.get(`${baseUrl}/api/getHeldPins`, {
signal: createAbortSignal(),
signal: createAbortSignal()
});
setLoading && setLoading(false);
return response.data;
} catch (error) {
setLoading && setLoading(false);
if (error?.code === 'ERR_CANCELED') return { canceled: true };
if (error?.code === 'ERR_CANCELED')
return { canceled: true };
else console.error(error);
}
}
Expand Down

0 comments on commit cffb11f

Please sign in to comment.