totalsync-webinterface 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. totalsync_webinterface/__init__.py +8 -0
  2. totalsync_webinterface/camera.py +163 -0
  3. totalsync_webinterface/curses_interface.py +142 -0
  4. totalsync_webinterface/fake_picamera.py +81 -0
  5. totalsync_webinterface/packet.py +194 -0
  6. totalsync_webinterface/pin_sheet.py +101 -0
  7. totalsync_webinterface/serial_dummy.py +92 -0
  8. totalsync_webinterface/serial_dump.py +66 -0
  9. totalsync_webinterface/teensy_commander.py +490 -0
  10. totalsync_webinterface/web/CanvasCamera.js +33 -0
  11. totalsync_webinterface/web/CanvasPlot.js +71 -0
  12. totalsync_webinterface/web/favicon.ico +0 -0
  13. totalsync_webinterface/web/index.html +31 -0
  14. totalsync_webinterface/web/interface.js +342 -0
  15. totalsync_webinterface/web/reconnecting-websocket/LICENSE.txt +21 -0
  16. totalsync_webinterface/web/reconnecting-websocket/README.md +149 -0
  17. totalsync_webinterface/web/reconnecting-websocket/package.json +19 -0
  18. totalsync_webinterface/web/reconnecting-websocket/reconnecting-websocket.js +365 -0
  19. totalsync_webinterface/web/style.css +165 -0
  20. totalsync_webinterface/web/webgl-plot/LICENSE +21 -0
  21. totalsync_webinterface/web/webgl-plot/README.md +184 -0
  22. totalsync_webinterface/web/webgl-plot/dist/webglplot.esm.js +619 -0
  23. totalsync_webinterface/web/webgl-plot/package.json +42 -0
  24. totalsync_webinterface/web_interface.py +268 -0
  25. totalsync_webinterface/websocket_server/LICENSE +21 -0
  26. totalsync_webinterface/websocket_server/__init__.py +1 -0
  27. totalsync_webinterface/websocket_server/websocket_server.py +377 -0
  28. totalsync_webinterface-0.1.1.dist-info/METADATA +41 -0
  29. totalsync_webinterface-0.1.1.dist-info/RECORD +32 -0
  30. totalsync_webinterface-0.1.1.dist-info/WHEEL +4 -0
  31. totalsync_webinterface-0.1.1.dist-info/entry_points.txt +2 -0
  32. totalsync_webinterface-0.1.1.dist-info/licenses/LICENSE +676 -0
@@ -0,0 +1,184 @@
1
+ ![Npm Build](https://github.com/danchitnis/webgl-plot/workflows/Npm%20Build/badge.svg) ![Yarn Build](https://github.com/danchitnis/webgl-plot/workflows/Yarn%20Build/badge.svg) ![Code scanning](https://github.com/danchitnis/webgl-plot/workflows/Code%20scanning/badge.svg) ![Build](https://github.com/danchitnis/webgl-plot/workflows/Build/badge.svg) [![DOI](https://zenodo.org/badge/205590760.svg)](https://zenodo.org/badge/latestdoi/205590760)
2
+
3
+ ## [Live demo 🚀](https://danchitnis.github.io/webgl-plot-examples/vanilla/)
4
+
5
+ # webgl-plot
6
+
7
+ multi-line high-performance 2D plotting library using native WebGL. The advantages are:
8
+
9
+ - Simple and efficient 2D WebGL library
10
+ - Using WebGL native line drawing
11
+ - High update rate which matches the screen's refresh rate (FPS)
12
+ - Works for both dynamic and static data
13
+ - Full control over the color of each line in each frame
14
+ - No dependencies
15
+ - Works on any browser/platform that [supports WebGL](https://caniuse.com/#feat=webgl)
16
+ - Compatible with [OffScreenCanvas](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) and [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) for offloading cpu time from the main thread
17
+ - Ideal for embedded systems with low resources or large datasets
18
+
19
+ ## Use cases
20
+
21
+ **Dynamic**: When plotting real-time multiple waveforms are required. For example, software-based oscilloscopes, Arduino, microcontrollers, FPGA user interfaces. This framework also can be used in combination with ElectronJS.
22
+
23
+ **Static**: Enables rapid pan and zoom capability for inspecting very large datasets. See the [static example](https://danchitnis.github.io/webgl-plot-examples/static.html)
24
+
25
+ ## Limitations
26
+
27
+ It cannot change the line width due to the OpenGL implementation of a line. The OpenGL specification only guarantees a minimum of a single pixel line width. There are other solutions to increase the line width however they substantially increase the size of the data vector and take a hit on the performance. Top performance (refresh rate, memory, etc) is the top priority for this library.
28
+
29
+ ## Getting started
30
+
31
+ Create an HTML canvas with an appropriate width or height:
32
+
33
+ ```html
34
+ <div>
35
+ <canvas style="width: 100%;" id="my_canvas"></canvas>
36
+ </div>
37
+ ```
38
+
39
+ Import WebGL-Plot library using ES6 modules:
40
+
41
+ ```javascript
42
+ import { WebglPlot, WebglLine, ColorRGBA } from "webgl-plot";
43
+ ```
44
+
45
+ Prepare the canvas
46
+
47
+ ```javascript
48
+ const canvas = document.getElementById("my_canvas");
49
+ const devicePixelRatio = window.devicePixelRatio || 1;
50
+ canvas.width = canvas.clientWidth * devicePixelRatio;
51
+ canvas.height = canvas.clientHeight * devicePixelRatio;
52
+ ```
53
+
54
+ Initialization:
55
+
56
+ ```javascript
57
+ const numX = canvas.width;
58
+ const color = new ColorRGBA(Math.random(), Math.random(), Math.random(), 1);
59
+ const line = new WebglLine(color, numX);
60
+ const wglp = new WebglPlot(canvas);
61
+ ```
62
+
63
+ Automatically arrange X values between [-1,1]:
64
+
65
+ ```javascript
66
+ line.arrangeX();
67
+ ```
68
+
69
+ Add the line to the webgl canvas:
70
+
71
+ ```javascript
72
+ wglp.addLine(line);
73
+ ```
74
+
75
+ Configure the requestAnimationFrame call:
76
+
77
+ ```javascript
78
+ function newFrame() {
79
+ update();
80
+ wglp.update();
81
+ requestAnimationFrame(newFrame);
82
+ }
83
+ requestAnimationFrame(newFrame);
84
+ ```
85
+
86
+ Add the update function:
87
+
88
+ ```javascript
89
+ function update() {
90
+ const freq = 0.001;
91
+ const amp = 0.5;
92
+ const noise = 0.1;
93
+
94
+ for (let i = 0; i < line.numPoints; i++) {
95
+ const ySin = Math.sin(Math.PI * i * freq * Math.PI * 2);
96
+ const yNoise = Math.random() - 0.5;
97
+ line.setY(i, ySin * amp + yNoise * noise);
98
+ }
99
+ }
100
+ ```
101
+
102
+ Don't forget to update the canvas with `wglp.update()` each time you want to redraw the changes that you have made to the line objects.
103
+
104
+ [![Edit WebGLplot](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/webglplot-m40u4?fontsize=14&hidenavigation=1&theme=dark)
105
+
106
+ ## Demos
107
+
108
+ See examples based on vanilla JS at [webgl-plot-examples](https://github.com/danchitnis/webgl-plot-examples)
109
+
110
+ See examples based on [React](https://webgl-plot-react.vercel.app/)
111
+
112
+ See [SPAD Simulation](https://danchitnis.github.io/SPADsim/) which use WebGL-Plot as an oscilloscope display
113
+
114
+ ## React Examples
115
+
116
+ For a basic React example see here:
117
+
118
+ [![Edit WebGL-Plot React](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/webgl-plot-react-8y1qj?fontsize=14&hidenavigation=1&theme=dark)
119
+
120
+ React website is under development...
121
+
122
+ [https://webgl-plot-react.vercel.app/](https://webgl-plot-react.vercel.app/) âš›
123
+
124
+ ## JS Bundle
125
+
126
+ To use WebGL-Plot as a JS pre-bundled package first import the following in your HTML file:
127
+
128
+ ```HTML
129
+ <script src="https://cdn.jsdelivr.net/gh/danchitnis/webgl-plot@master/dist/webglplot.umd.min.js"></script>
130
+ ```
131
+
132
+ See examples on how to use this bundle in [Codepen](https://codepen.io/danchitnis/pen/mdJVEYY) and [JSfiddle](https://jsfiddle.net/danchitnis/mfcw73z2/)
133
+
134
+ For ES6 module and direct browser import use:
135
+
136
+ ```HTML
137
+ <script type="module" src="your-code.js"></script>
138
+ ```
139
+
140
+ and in your-code.js:
141
+
142
+ ```javascript
143
+ import {
144
+ WebglPlot,
145
+ WebglLine,
146
+ ColorRGBA,
147
+ } from "https://cdn.jsdelivr.net/gh/danchitnis/webgl-plot@master/dist/webglplot.esm.min.js";
148
+ ```
149
+
150
+ Thanks to [TimDaub](https://github.com/TimDaub) for testing the ES6 module.
151
+
152
+ Notice that this method is only recommended for test and small codes.
153
+
154
+ ## SkyPack
155
+
156
+ [Skypack](https://www.skypack.dev/view/webgl-plot) is a new exciting CDN for ESM Javascript. See the example below on how to use it:
157
+ [JSfiddle](https://jsfiddle.net/danchitnis/tu1svwbp/)
158
+
159
+ ## Benchmark
160
+
161
+ [Line generation and Frame rate](https://danchitnis.github.io/webgl-plot/benchmark/bench1.html)
162
+
163
+ ## Internal test
164
+
165
+ [ESM](https://danchitnis.github.io/webgl-plot/test/index-esm.html), [off-screen](https://danchitnis.github.io/webgl-plot/test/index-esm-off.html), [UMD](https://danchitnis.github.io/webgl-plot/test/index-umd.html)
166
+
167
+ ## API Documentation
168
+
169
+ See [here 📑](https://webgl-plot.now.sh/)
170
+
171
+ ## How to use with embedded systems applications?
172
+
173
+ You can use WebUSB, Web Bluetooth, and Serial API. You can use [ComPort](https://github.com/danchitnis/ComPort) for a basic implementation of Serial API
174
+
175
+ ## Build
176
+
177
+ ```bash
178
+ npm i
179
+ npm run build
180
+ ```
181
+
182
+ ## License
183
+
184
+ MIT