Docs improvements,
This commit is contained in:
+14
-18
@@ -1,4 +1,4 @@
|
||||
### How to Debug PiPedal.
|
||||
### How to Debug PiPedal
|
||||
|
||||
PipPedal consists of the following components:
|
||||
|
||||
@@ -41,7 +41,7 @@ In production, the pipedald web server serves the PiPedal web socket, as well as
|
||||
react components. But while debugging, it is much more convenient to use the React debug server for
|
||||
React sources, and configure pipedald to serve only the websocket.
|
||||
|
||||
To start the React debug server, from a shell, cd to the react directory, and run "./start". The react debug
|
||||
To start the React debug server, from a shell, `cd` to the react directory, and run `./start`. The react debug
|
||||
server will detect any changes to React sources, and rebuild them automatically (no build step required).
|
||||
Actual debugging is performed using the Chrome debugger (which is remarkably well integrated with React).
|
||||
|
||||
@@ -54,10 +54,9 @@ files:
|
||||
|
||||
followed by `sudo sysctl -p`. Note that VS Code and the React framework both need this change.
|
||||
|
||||
By default, the React app will attempt to contact the pipedald server on ws:*:8080 -- the address on which
|
||||
By default, the debug React app will attempt to contact the pipedald server on ws:*:8080 -- the address on which
|
||||
the debug version of pipedald listens on. This can be reconfigured
|
||||
in the file react/src/public/var/config.json if desired. If you connect to the the pipedald server port, pipedald intercepts requests for this file and
|
||||
points the react app at itself, so the file has no effect when running in production.
|
||||
in the file `react/src/public/var/config.json` if desired. If you connect to the the pipedald server port, pipedald intercepts requests for this file and points the react app at itself, so the file has no effect when running in production.
|
||||
|
||||
The React app will display the message "Error: Failed to connect to the server", until you start the pipedald websocket server in the VSCode debugger. It's quite reasonable to point the react debug app at a production instance of the pipedald server instead.
|
||||
|
||||
@@ -70,8 +69,7 @@ The React app will display the message "Error: Failed to connect to the server",
|
||||
}
|
||||
|
||||
Setting socket_server_address to "*" configures the web app to reconnect using the host address the browser
|
||||
request used to connect to the web app. (e.g. 127.0.0.1, or pipedal.local, &c). If you choose to provide an explicit address,
|
||||
remember that it is to that address that the web browser will connect.
|
||||
request used to connect to the web app. (e.g. 127.0.0.1, pipedal.local, the address of the Wi-Fi Direct connection &c). If you choose to provide an explicit address, remember that it is to that address that the web browser will connect.
|
||||
|
||||
The original development for this app was done with Visual Studio Code. Open the root project directory in
|
||||
Visual Studio Code, and it will detect the CMake build files, and configure itself appropriately. Wait for
|
||||
@@ -82,13 +80,16 @@ bottom of the Visual Studio Code window. Set the build variant to debug. Set the
|
||||
Click on the Build button to build the app. Click on the Debug button to launch a debugger.
|
||||
|
||||
To get the debugger to launch and run correctly, you will need to set command-line parameters for pipedald.
|
||||
Command-line arguments can be set in the file .vscode/settings.json:
|
||||
Command-line arguments can be set in the file `.vscode/launch.json`:
|
||||
|
||||
{
|
||||
...
|
||||
"cmake.debugConfig": {
|
||||
"args": [
|
||||
"<projectdirectory>/debugConfig","<projectdirectory>/build/react/src/build", "-port", "0.0.0.0:8080"
|
||||
"<projectdirectory>/debugConfig",
|
||||
"<projectdirectory>/build/react/src/build",
|
||||
"-port",
|
||||
"0.0.0.0:8080"
|
||||
],
|
||||
|
||||
...
|
||||
@@ -99,19 +100,14 @@ where `<projectdirectory>` is the root directory of the pipedal project.
|
||||
The default debug configuration for pipedal is configured to use /var/pipedal for storing working data files,
|
||||
which allows it to share configuration with a production instance of pipedal. Be warned that the permissioning
|
||||
for this folder is intricate. If you plan to use the data from a production server, get the production server
|
||||
installed first so the permissions are set correctly. If you install a production instance later, remove the
|
||||
entire directory before doing so, to ensure that none of the files in that directory are permissioned
|
||||
incorrectly.
|
||||
installed first so the permissions are set correctly.
|
||||
If you install a production instance later, remove the entire directory before doing so, to ensure that none
|
||||
of the files in that directory are permissioned incorrectly.
|
||||
|
||||
You will need to add your userid to the pipedal_d group if you plan to share the /var/pipedal directory.
|
||||
|
||||
sudo usermod -a -G pipedal_d *youruserid*
|
||||
|
||||
You will need to add your userid to the bluetooth group if you plan to debug Bluetooth onboarding code.
|
||||
|
||||
sudo usermod -a -G bluetooth *youruserid*
|
||||
|
||||
|
||||
Or you can avoid all of this, by configuring the debug instance to use a data folder in your home directory. Edit
|
||||
`debugConfig/config.json`:
|
||||
|
||||
@@ -122,4 +118,4 @@ Or you can avoid all of this, by configuring the debug instance to use a data fo
|
||||
}
|
||||
|
||||
-----
|
||||
[<< The Build System](TheBuildSystem.md) | [Up](Documentation.md)
|
||||
[<< The Build System](TheBuildSystem.md) | [Up](Documentation.md) | [PiPedal Architecture >>](Architecture.md)
|
||||
Reference in New Issue
Block a user