Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
939764c
UdpServer: docs
giuliomoro Apr 21, 2023
8a41610
UdpServer: better cleanup, provided implementation for new version of…
giuliomoro Apr 21, 2023
da4a4df
NIT: UdpServer: fixed (most?) whitespaces
giuliomoro Apr 21, 2023
a5bde77
UdpServer: removed unnecessary variables and memory leak
giuliomoro Apr 21, 2023
fd35d48
UdpServer: removed more unnecessary instance variables, factored out …
giuliomoro Apr 21, 2023
98c4d69
UdpServer: re-enabled (and fixed) blockUntilSpecifiedAmountHasArrived
giuliomoro Apr 21, 2023
521a0ac
NIT: UdpServer: check for !enabled instead
giuliomoro Apr 21, 2023
7ea1a42
UdpServer: removed bindToPort() which was anyhow not working. Also
giuliomoro Apr 21, 2023
0bd6d7a
UdpServer: further removing unused instance variables, simplified inc…
giuliomoro Apr 21, 2023
4f1bd6d
Bela.h: added support for printf-style compiler warnings
giuliomoro May 12, 2023
ea7a398
Spi_Codec: enable reset pin of ADS816x.
giuliomoro May 23, 2023
21eaac1
When ADS816x, ensure you sleep or otherwise wait enough between rese…
giuliomoro May 31, 2023
2559623
default_libpd_render: BELA_LIBBPD_SERIAL: added support for raw bytes
giuliomoro Jun 2, 2023
1e116c1
default_libpd_render: fixed argument to rt_printf
giuliomoro Jun 2, 2023
f6f2587
WSServer: pass address and identifier to each callback. Amended Gui a…
giuliomoro Jul 18, 2023
53313d4
Gui: better handle num of connections by keeping track of individual …
giuliomoro Jul 18, 2023
32f34fd
WriteFile: overhaul, removed C-style string manipulation, any relianc…
giuliomoro Jul 19, 2023
378a88a
PRU: cleared up cleanup, factored out to its own method, also assume …
giuliomoro Jul 19, 2023
2cd6c71
RTAudio: if exiting early because of error in setup(), ensure we clea…
giuliomoro Jul 19, 2023
fbdff0c
GPIOcontrol: gpio_export(): close fd only if it's valid, not the othe…
giuliomoro Jul 19, 2023
6ccb4ad
WSServer: do _not_ store a shared_ptr to the server on the handler, o…
giuliomoro Jul 20, 2023
80862ed
WSServer: avoid possible future pitfalls by capturing weak_ptr instea…
giuliomoro Jul 20, 2023
b096836
Gui: ensure the last ws_disconnect is called while the object (and it…
giuliomoro Jul 20, 2023
753df1f
AuxTask{Non,}RT: hardened by removing mallocs
giuliomoro Jul 21, 2023
c5eed1d
Scope: removed some memory leaks
giuliomoro Jul 21, 2023
8a195b3
Scope: do not call disconnect callback on a destroyed object
giuliomoro Jul 21, 2023
14e7e94
WSServer: do not capture connection in the lambda for execution on th…
giuliomoro Jul 21, 2023
a154fb8
WSServer: when calling sendNonRt(), allow to specify if calling direc…
giuliomoro Jul 21, 2023
4174384
AuxTaskRT: timed write on exit, to avoid hanging the destructor if th…
giuliomoro Jul 21, 2023
2bce267
default_libpd_render: remove uses of malloc and new [] (which were le…
giuliomoro Jul 22, 2023
c86f1f7
WSServer: stop the server (and its callbacks) before everything else
giuliomoro Jul 22, 2023
53a793b
I2c: do not leak file descriptor on shutdown.
giuliomoro Jul 22, 2023
ccbad7b
default_libpd_render: handle bidirectional UART data
giuliomoro Jul 24, 2023
f7d843b
uart-communication example for Pd
giuliomoro Jul 24, 2023
903ba4e
DataBuffer: support all data types that the GUI already supports
giuliomoro Aug 3, 2023
23bf066
Gui: backwards-compatible API
giuliomoro Aug 4, 2023
50af3c0
AudioFileReader: allow to set starting frame at setup
giuliomoro Aug 7, 2023
71dec07
WriteFile: using + separator between base of filename and counter. Al…
giuliomoro Aug 11, 2023
5f1c0bc
WriteFile: use 1MB buffer per binary file as default instead of 10MB
giuliomoro Aug 11, 2023
8fdc5c8
WriteFile: allow to delete file upon cleanup()
giuliomoro Aug 11, 2023
75c274b
Gui: (js) add .type to each buffer
giuliomoro Aug 12, 2023
ca4abd4
createXenomaiPipe: poolsz should be size_t
anbjoernskov Aug 11, 2023
fe1c433
OscReceiver: missing include
giuliomoro Aug 15, 2023
512a21d
NIT: UdpClient: const
giuliomoro Aug 15, 2023
b58758f
OscSender: added sendNonRt() which bypasses the outgoing pipe
giuliomoro Aug 15, 2023
66b425a
Communication/OSC: fixed
giuliomoro Aug 15, 2023
8f24bae
WriteFile: requestFlush()
giuliomoro Aug 15, 2023
29d6f7e
NIT: WriteFile: moved headers to implementation
giuliomoro Aug 18, 2023
0d819ea
Scope: display ms/div or hz/div in a decent format. Also fixes a bug …
giuliomoro Aug 22, 2023
be8ef54
Scope: Zoom In and Zoom Out work more naturally ("logarithmically") b…
giuliomoro Aug 22, 2023
dfd5fa7
Scope: allow remoteHost= querystring to replace the default server:po…
giuliomoro Aug 22, 2023
f39be91
Scope: safely avoid division by zero
giuliomoro Aug 22, 2023
511bf75
Scope: also set a zoom in limit in the frontend
giuliomoro Aug 22, 2023
89c4583
Scope: prepend timestamp to outgoing buffer
giuliomoro Aug 22, 2023
f76e548
Scope: autoRoll when downSampling is above 8
giuliomoro Aug 22, 2023
bc8eb08
Scope: for high downSampling, schedule trigger task frequently enough
giuliomoro Aug 22, 2023
e44a629
Scope: toggle between real roll and simple non-triggering incremental…
giuliomoro Aug 22, 2023
8b0aea1
Scope: added control for X axis behaviour
giuliomoro Aug 22, 2023
abd4bcc
Scope: for incremental drawing, fade out older values
giuliomoro Aug 22, 2023
0988405
Scope: if passing controlOnly=1, do not try to establish data websocket
giuliomoro Aug 23, 2023
277bcae
Scope: pixi updated to v6.5.10
giuliomoro Aug 23, 2023
5a3733c
Scope: pixi fixed initialisation for v6 (this is still backwards comp…
giuliomoro Aug 23, 2023
7aca8a5
frontend-dev: do not exit on scope-browserify error. Also re-enable l…
giuliomoro Aug 23, 2023
4face1c
Scope: antialias
giuliomoro Aug 23, 2023
e7e929c
Scope: added (disabled) load test that doesn't require a Bela program…
giuliomoro Aug 23, 2023
469957c
Scope: allow to disable individual websockets with controlDisabled= a…
giuliomoro Aug 24, 2023
a045e6c
Scope: pixi-legacy v7.2.4
giuliomoro Aug 24, 2023
dd911d7
Scope: added (disabled) benchmark for time spent drawing
giuliomoro Aug 24, 2023
93aea3d
Scope: allow to set native line
giuliomoro Aug 24, 2023
3fda4e9
NIT: Scope: removed dead branch and reindented
giuliomoro Aug 24, 2023
d2e6239
Scope: removed exponential notation from x axis markers
giuliomoro Aug 25, 2023
7469e1a
Scope: update frontend with backend data for more (all?) parameters
giuliomoro Aug 25, 2023
279a510
Scope: update frontend with backend data for more (all?) parameters
giuliomoro Aug 25, 2023
77f8d15
NIT: Scope: removed stale sliders code
giuliomoro Aug 25, 2023
72c5798
Scope: factored out sending to websocket
giuliomoro Aug 25, 2023
98da864
NIT: Scope: refactored setScopeStatus()
giuliomoro Aug 25, 2023
1e4fefc
NIT: Scope: controlsVisibility()
giuliomoro Aug 25, 2023
846db38
Scope: if dataDisabled, show controls by default and hide some stuff
giuliomoro Aug 25, 2023
e616cb6
NIT: Scope: added note of TODO
giuliomoro Aug 25, 2023
fb8054f
Scope: querytsring for tweaking GUI performance
giuliomoro Aug 25, 2023
10687fa
Scope: fixed load test
giuliomoro Aug 25, 2023
4c7fbd1
NIT: Scope: removed stale code
giuliomoro Aug 26, 2023
ba82491
Scope: have 0 scope channels by default, always send to frontend all …
giuliomoro Sep 4, 2023
ed53677
Scope: added dark mode. Also slightly changed the blue color (more ma…
giuliomoro Sep 4, 2023
ed718ac
Scope: added showLabels
giuliomoro Sep 4, 2023
291d235
Scope: changed default lineWidth
giuliomoro Sep 4, 2023
28a2873
Scope: default to showLabels
giuliomoro Sep 4, 2023
42ecd89
Scope: darkMode toggles a class in <body> which in turns affects some…
giuliomoro Sep 4, 2023
78111a8
Scope: added apple-specific stuff so it can be visualised full screen
giuliomoro Sep 4, 2023
bd96fdb
default_libpd_render: handle lists/msgs sent to bela_system and execu…
giuliomoro Sep 5, 2023
97b86de
Gui: use location.hostname instead of location.host so it works even …
giuliomoro Sep 7, 2023
3aa80f1
PureData/samples-record: have the behaviour match the comment
giuliomoro Sep 10, 2023
be0500c
Bela_initRtBackend()
giuliomoro Sep 13, 2023
a6cbc7e
Bela_initRtBackend() using call_once() for thread safety
giuliomoro Sep 14, 2023
03f6fd4
Pipe: start with an actually invalid fd
giuliomoro Sep 14, 2023
02e7dc0
default_libpd_render: system: avoid unnecessary leading space
giuliomoro Sep 14, 2023
f9246f4
IDE: open scope and GUI in a given target, so if it was already opene…
giuliomoro Oct 9, 2023
3de8124
RTAudio: fixed channel and frame count for Batch
giuliomoro Oct 9, 2023
8014f37
Gui: a connection can set itself as active/inactive and the Gui keeps…
giuliomoro Oct 9, 2023
2ed047a
Gui: add a count and ts to incoming data buffers so the user can know…
giuliomoro Oct 10, 2023
c374cbc
PureData/serial example
giuliomoro Oct 12, 2023
ab3c50a
IDE: remove readonly stuff on opening a file
giuliomoro Oct 12, 2023
fad5569
IDE: do not refresh the page when reloading the file from the file op…
giuliomoro Oct 12, 2023
6ca640f
Gui: erase active connection on disconnect
giuliomoro Oct 19, 2023
bcf6e57
Makefile: removed wheezy support
giuliomoro Jul 10, 2022
2e98557
resources: removed wheezy support
giuliomoro Jul 10, 2022
ee6d09d
Xenomai: removed support for Xenomai 2 and native/alchemy skin. Prepr…
giuliomoro Jun 18, 2022
6661562
Makefile: removed -DXENOMAI_MAJOR and -DXENOMAI_SKIN_*. Leaving XENOM…
giuliomoro Jun 19, 2022
15f4276
Xenomai: factored out __wrap_ to BELA_RT_WRAP()
giuliomoro Jun 19, 2022
cb5c258
Xenomai: factored out __wrap_ to BELA_RT_WRAP()
giuliomoro Jun 19, 2022
e296935
Xenomai: properly define BELA_RT_WRAP so that the default behaviour i…
giuliomoro Jun 19, 2022
59abd6a
Xenomai: replace createXenomaiPipe() with createBelaRtPipe(), which i…
giuliomoro Jun 19, 2022
07dec81
Do not check for existing instance or initialise Xenomai if not __COB…
giuliomoro Jul 10, 2022
16877f3
Makefile: introducing BELA_RT_BACKEND to select between xenomai and a…
giuliomoro Jun 19, 2022
e460550
RtWrappers: renamed xenomai_wraps.h to RtWrappers.h and moved impleme…
giuliomoro Aug 22, 2022
1a125c1
NIT: fixed headers
giuliomoro Aug 22, 2022
f4b7fe1
Added Bela_*printf. Implemented rt_*printf for non-Xenomai cases
giuliomoro Aug 22, 2022
4c7a670
Makefile: no longer need to -D rt_*printf
giuliomoro Aug 22, 2022
5a37274
Added XenomaiLock.{cpp,h} from supercollider@b77311760b0d2bf6e69c4a57…
giuliomoro Aug 23, 2022
4087869
RtLock: renamed XenomaiLock files to RtLock. Also substituted within …
giuliomoro Aug 23, 2022
21104fa
RtLock: applied Bela formatting ('s/ /\t/g') and removed SC define
giuliomoro Aug 23, 2022
fdc9513
RtLock: removed XenomaiInitializer
giuliomoro Aug 23, 2022
c0f259b
RtLock: changing __wrap with BELA_RT_WRAP, handling non-COBALT case a…
giuliomoro Aug 22, 2022
d46306f
RtLock: added RtConditionVariable::wait(RtMutex&)
giuliomoro Aug 23, 2022
e254df1
AuxiliaryTask: use RtLock
giuliomoro Aug 23, 2022
a1ce287
RtLock: hide implementation in the implementation file
giuliomoro Aug 23, 2022
0634561
RtLock: PRINT_XENO_LOCK renamed to PRINT_RT_LOCK
giuliomoro Aug 23, 2022
164ba53
RtLock: NIT: refactored to use pthread_agnostic functions and paramet…
giuliomoro Aug 23, 2022
e65da17
MiscUtilities: return error from writeTextFile() if the file is no lo…
giuliomoro Aug 24, 2022
c739400
RtWrappers: take cpuset as a parameter.
giuliomoro Aug 24, 2022
eabe6e3
RtWrappers: moved initialiseRt() and turnIntoRtThread() from RtLock t…
giuliomoro Aug 24, 2022
dacc99f
Pipe: allow to build with RtWrappers.h
giuliomoro Sep 27, 2023
cd2df41
RtLock: rely on the singleton Bela_initRtBackend()
giuliomoro Sep 28, 2023
47db665
RTAudio, RtWrapper: moved CATCH_MSW to RtWrapper
giuliomoro Sep 28, 2023
c818a3d
RtAudio, RtWrapper: moved Bela_initRtBackend() to RtWrapper
giuliomoro Sep 28, 2023
7714c36
Parametrised SPI chip select lines
giuliomoro Jul 31, 2021
6fedd2c
Makefile: NIT: writing CORE_CORE_OBJS entries one per line
giuliomoro Sep 29, 2023
0db0e1f
xenomai_init: resetting optind before calling it
giuliomoro Oct 23, 2023
344e85f
Midi: removed XENOMAI_SKIN_native support and fixed include
giuliomoro Oct 24, 2023
dd3819e
examples/PureData/custom-render-ADXL345
giuliomoro Oct 24, 2023
e10cdc2
NIT: Gui: Removed unused code mistakenly added in 3aa8b3ebaa164c6117e…
giuliomoro Oct 27, 2023
c8bb72f
Gui: removed duplicated defaults
giuliomoro Oct 27, 2023
955f373
Gui: allow the fronted to override sketchName, wsPort, and { wsPrefix…
giuliomoro Oct 27, 2023
4698e1f
WSServer: add port to ws pipe name, so we can have multiple websocket…
giuliomoro Oct 29, 2023
39d4a02
Gui: on the frontend, interpret projectName as either projectName or …
giuliomoro Oct 29, 2023
1a4843e
Gui: docs and using const&
giuliomoro Oct 29, 2023
69cca22
default_libpd_render: added BELA_SYSTEM_THREADED in order to make bel…
giuliomoro Nov 2, 2023
c670786
Makefile.libraries: ensure they are built with -fPIC
giuliomoro Nov 7, 2023
0ee3608
Makefile: EXPORT_ALL_VARIABLES twice because once doesn't seem to suf…
giuliomoro Nov 7, 2023
36c6e4f
Spi_Codec: set _shouldPinmux first thing
giuliomoro Oct 23, 2023
b877e9f
Spi_Codec: export and set direction for all relevant pins. This seems…
giuliomoro Oct 23, 2023
19d5e7e
NIT: board_detect: factored out detectBelaRevC() to a single call
giuliomoro Oct 23, 2023
8562fb4
I2c: inheriting classes should use writeBytes() and readBytes() where…
giuliomoro Nov 28, 2023
bdc28ca
I2c: specify that we are using the global namespace for read() and wr…
giuliomoro Nov 28, 2023
a2fd260
I2c.h: add readRaw / writeRaw
giuliomoro Nov 29, 2023
5b7e0c0
Es9080_Codec: fixed print
giuliomoro Nov 29, 2023
9e4525c
NIT: gXenomaiInited where it's used
giuliomoro Dec 5, 2023
fb615e8
NIT: missing include
giuliomoro Dec 5, 2023
0e980af
examples/Audio/variable-filter
giuliomoro Dec 7, 2023
bc18c3b
PureData/custom-render*: updated to latest default_libpd_render
giuliomoro Dec 8, 2023
2ed2ede
examples: misc printfs fixes
giuliomoro Dec 8, 2023
259312d
Instruments/d-box: removed support for different Xenomai skins
giuliomoro Dec 8, 2023
c95ea36
default_libpd_render: fixed serial input buffer
giuliomoro Jan 9, 2024
47c54fe
Sensors/DHT11-temperature-sensor example
giuliomoro Jan 9, 2024
38444ce
AuxTaskNonRT: allow to set priority
giuliomoro Jan 29, 2024
08c7620
Midi: modernised, using string and AuxTaskNonRT, removed dependency on
giuliomoro Jan 17, 2024
d37ca26
Added gui option theme switch
Laimonade Jan 30, 2024
69bd93e
implemented callback to switch code editor theme
Laimonade Jan 30, 2024
33d3ecf
implemented callback to switch code editor theme
Laimonade Jan 30, 2024
6d14b7c
added switchable dark theme to default IDE settings
Laimonade Jan 31, 2024
b66b12c
implemented css class switch
Laimonade Feb 2, 2024
1ad3467
added css variables
Laimonade Feb 2, 2024
92782c8
implemented custom ACE xcode dark theme
Laimonade Feb 2, 2024
fe60e74
Trill: do not print errors when probing
giuliomoro Feb 1, 2024
78b9fd7
Trill: re-enable kScanTriggerI2c for rev 3 sensors. This issue has be…
giuliomoro Feb 5, 2024
f98d815
Trill: added probeRange() and allow to pass Trill::UNKNOWN to setup()…
giuliomoro Feb 6, 2024
77e3f02
Trill: use ANY instead of UNKNOWN
giuliomoro Feb 6, 2024
08bef77
NIT: typo
giuliomoro Feb 6, 2024
ab8cecd
Trill: default to ANY in setup()
giuliomoro Feb 6, 2024
cdda35b
Trill/{detect-all-devices,general-*}: take advantage of new API
giuliomoro Feb 6, 2024
c954b74
Midi: add more information on port, retrievabble
giuliomoro Feb 8, 2024
0434fd7
default_libpd_render: overhauled MIDI initialisation, using dedicated
giuliomoro Feb 8, 2024
ca376b0
Merge remote-tracking branch 'upstream/dev' into dev-dark-theme-new
Laimonade Feb 14, 2024
dbbcd3f
implemented theme switching for color-themed elements
Laimonade Feb 14, 2024
51f33d3
implemented main logic for color-theme switching
Laimonade Feb 14, 2024
f7c020b
implemented function to switch editor & css class themes
Laimonade Feb 14, 2024
01d4c9a
implemented custom xcode dark theme editor
Laimonade Feb 14, 2024
ac5085a
transpiled css from scss
Laimonade Feb 14, 2024
fe7dabb
transpiled js from gulp
Laimonade Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion IDE/dist/IDESettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ function default_IDE_settings() {
'cpuMonitoring': 1,
'cpuMonitoringVerbose': 0,
'consoleDelete': 0,
'viewHiddenFiles': 0
'viewHiddenFiles': 0,
'darkTheme': 0
};
}
3 changes: 1 addition & 2 deletions IDE/frontend-dev/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ gulp.task('scope-browserify', () => {
.on('error', function(error){
console.error(error);
this.emit('end');
exit(1);
})
.pipe(source('bundle.js'))
.pipe(buffer())
Expand All @@ -150,7 +149,7 @@ gulp.task('sass', () => {
});

gulp.task('watch-local', () => {
//livereload.listen();
livereload.listen();
// when the browser js changes, browserify it
gulp.watch(['./src/**'], ['browserify']);
// when the scope browser js changes, browserify it
Expand Down
42 changes: 33 additions & 9 deletions IDE/frontend-dev/scope-src/BackgroundView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class BackgroundView extends View{

constructor(className, models, renderer){
super(className, models);
this.darkMode = models[1].getKey('darkMode');
this.showLabels = models[1].getKey('showLabels');
var saveCanvas = document.getElementById('saveCanvas');
this.canvas = document.getElementById('scopeBG');
saveCanvas.addEventListener('click', () => {
Expand All @@ -20,7 +22,7 @@ class BackgroundView extends View{
canvas.height = window.innerHeight;
var ctx = canvas.getContext('2d');
ctx.rect(0, 0, canvas.width, canvas.height);
ctx.fillStyle="white";
ctx.fillStyle = this.darkMode ? "black" : "white";
ctx.fill();
//ctx.clearRect(0, 0, canvas.width, canvas.height);

Expand All @@ -36,21 +38,31 @@ class BackgroundView extends View{
//console.log(xTime);

//faint lines
ctx.strokeStyle = '#000000';
ctx.fillStyle="grey";
ctx.strokeStyle = this.darkMode ? '#fff' : '#000';
ctx.fillStyle= this.darkMode ? '#fff' : '#000';
ctx.font = "14px inconsolata";
ctx.textAlign = "center";
ctx.lineWidth = 0.2;
ctx.lineWidth = this.darkMode ? 1 : 0.2;
ctx.setLineDash([]);
ctx.beginPath();
ctx.fillText(0, canvas.width/2, canvas.height/2+11);
if(this.showLabels)
ctx.fillText(0, canvas.width/2, canvas.height/2+11);
for (var i=1; i<numVLines; i++){
ctx.moveTo(canvas.width/2 + i*xPixels, 0);
ctx.lineTo(canvas.width/2 + i*xPixels, canvas.height);
ctx.fillText((i*mspersample).toPrecision(2), canvas.width/2 + i*xPixels, canvas.height/2+11);
let val = (i * mspersample);
if(val < 10)
val = val.toFixed(2);
else if(val < 100)
val = val.toFixed(1);
else
val = val.toFixed(0);
if(this.showLabels)
ctx.fillText(val, canvas.width/2 + i*xPixels, canvas.height/2+11);
ctx.moveTo(canvas.width/2 - i*xPixels, 0);
ctx.lineTo(canvas.width/2 - i*xPixels, canvas.height);
ctx.fillText((-i*mspersample).toPrecision(2), canvas.width/2 - i*xPixels, canvas.height/2+11);
if(this.showLabels)
ctx.fillText("-" + val, canvas.width/2 - i*xPixels, canvas.height/2+11);
}

var numHLines = 6;
Expand Down Expand Up @@ -95,6 +107,7 @@ class BackgroundView extends View{
//dashed lines
ctx.beginPath();
ctx.setLineDash([2, 5]);
ctx.lineWidth = this.darkMode ? 0.5 : 0.2;

ctx.moveTo(0, canvas.height*3/4);
ctx.lineTo(canvas.width, canvas.height*3/4);
Expand Down Expand Up @@ -135,7 +148,7 @@ class BackgroundView extends View{
var numVlines = 10;

//faint lines
ctx.strokeStyle = '#000000';
ctx.strokeStyle = this.darkMode ? '#fff' : '#000';
ctx.fillStyle="grey";
ctx.font = "14px inconsolata";
ctx.textAlign = "center";
Expand All @@ -155,7 +168,8 @@ class BackgroundView extends View{
val = (Math.pow(Math.E, -(Math.log(1/window.innerWidth))*i/numVlines) * (this.models[0].getKey('sampleRate')/(2*window.innerWidth)) * (data.upSampling/data.downSampling)).toFixed(0);
}

ctx.fillText(val, i*window.innerWidth/numVlines, canvas.height-2);
if(this.showLabels)
ctx.fillText(val, i*window.innerWidth/numVlines, canvas.height-2);
}
}

Expand All @@ -180,6 +194,16 @@ class BackgroundView extends View{
ctx.stroke();
}

_showLabels(value, data){
this.showLabels = value;
this.repaintBG(this.models[0].getKey('xTimeBase'), this.models[0]._getData());
}

_darkMode(value, data) {
this.darkMode = value;
this.repaintBG(this.models[0].getKey('xTimeBase'), this.models[0]._getData());
}

__xTimeBase(value, data){
//console.log(value);
this.repaintBG(value, data);
Expand Down
36 changes: 29 additions & 7 deletions IDE/frontend-dev/scope-src/ChannelView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ function ChannelConfig(){
this.yAmplitude = 1;
this.yOffset = 0;
this.color = '0xff0000';
this.lineWeight = 1.5;
this.lineWeight = 5;
this.enabled = 1;
}

var channelConfig = [new ChannelConfig()];
var colours = ['0xff0000', '0x0000ff', '0x00ff00', '0xff8800', '0xff00ff', '0x00ffff', '0x888800', '0xff8888'];
var channelConfig = [];

var tdGainVal = 1, tdOffsetVal = 0, tdGainMin = 0.5, tdGainMax = 2, tdOffsetMin = -5, tdOffsetMax = 5;
var FFTNGainVal = 1, FFTNOffsetVal = -0.005, FFTNGainMin = 0.5, FFTNGainMax = 2, FFTNOffsetMin = -1, FFTNOffsetMax = 1;
Expand All @@ -22,6 +21,17 @@ class ChannelView extends View{

constructor(className, models){
super(className, models);
this.darkMode = this.models[1].getKey('darkMode');
this.colors = [
'0xff0000',
'0x94d6ff',
'0x00ff00',
'0xff8800',
'0xff00ff',
'0x00ffff',
'0x888800',
'0xff8888'
];
}

// UI events
Expand Down Expand Up @@ -82,6 +92,10 @@ class ChannelView extends View{
}
}

_darkMode(val){
this.darkMode = val;
}

_numChannels(val){
var numChannels = val;
if (numChannels < channelConfig.length){
Expand All @@ -91,17 +105,25 @@ class ChannelView extends View{
}
} else if (numChannels > channelConfig.length){
while(numChannels > channelConfig.length){
channelConfig.push(new ChannelConfig());
channelConfig[channelConfig.length-1].color = colours[(channelConfig.length-1)%colours.length];
var el = $('.channel-view-0')
let cf = new ChannelConfig();
channelConfig.push(cf);
cf.color = this.colors[(channelConfig.length - 1) % this.colors.length];
var el = $('.channel-view-template')
.clone(true)
.prop('class', 'channel-view-'+(channelConfig.length))
.prop('style', '') // remove display: none
.appendTo($('.control-section.channel'));
el.find('[data-channel-name]').html('Channel ' + channelConfig.length);
el.find('input').each(function(){
$(this).data('channel', channelConfig.length-1)
});
el.find('input[type=color]').val(colours[(channelConfig.length-1)%colours.length].replace('0x', '#'));
for(let key in cf) {
let prop = el.find('input[data-key=' + key + ']');
if('color' === key)
prop.val(cf.color.replace('0x', '#'));
else
prop.val(cf[key]);
}
}
}
this.emit('channelConfig', channelConfig);
Expand Down
116 changes: 78 additions & 38 deletions IDE/frontend-dev/scope-src/ControlView.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ class ControlView extends View{
super(className, models);
$('#controlsButton, .overlay').on('click', () => this.toggleControls());
$('body').on('keydown', (e) => this.keyHandler(e));
this.addGenericHandlers();
}

toggleControls(){
if (controls) {
controls = false;
$('#control-panel').addClass('hidden');
$('.overlay').removeClass('active');
} else {
controls = true;
controlsVisibility(show) {
controls = show;
if(show) {
$('#control-panel').removeClass('hidden');
$('.overlay').addClass('active');
} else {
$('#control-panel').addClass('hidden');
$('.overlay').removeClass('active');
}
}
toggleControls(){
this.controlsVisibility(!controls);
}

keyHandler(e){
if (e.key === 'Escape') {
Expand All @@ -46,19 +49,22 @@ class ControlView extends View{
buttonClicked($element, e){
if ($element.data().key === 'upSampling'){
if (downSampling > 1){
downSampling -= 1;
downSampling /= 2;
this.emit('settings-event', 'downSampling', downSampling);
} else {
upSampling += 1;
this.emit('settings-event', 'upSampling', upSampling);
if(upSampling < 64) {
// an arbitrary limit: higher than this and pileups start happening
upSampling *= 2;
this.emit('settings-event', 'upSampling', upSampling);
}
}
// this._upSampling();
} else if ($element.data().key === 'downSampling'){
if (upSampling > 1){
upSampling -= 1;
upSampling /= 2;
this.emit('settings-event', 'upSampling', upSampling);
} else {
downSampling += 1;
downSampling *= 2;
this.emit('settings-event', 'downSampling', downSampling);
}
// this._downSampling();
Expand All @@ -84,43 +90,58 @@ class ControlView extends View{
}
}

msDiv() {
let time = (xTime * downSampling/upSampling);
if(time < 10)
time = time.toFixed(2);
else if (time < 100)
time = time.toFixed(1);
else
time = time.toFixed(0);
return time;
}

hzDiv() {
let hz = (sampleRate/20 * upSampling/downSampling);
return hz.toFixed(0);
}

updateUnitDisplay(data) {
let unitDisplay;
if (data.plotMode == 0){
unitDisplay = this.msDiv();
} else if (data.plotMode == 1){
unitDisplay = this.hzDiv();
}
$('.xUnit-display').html(unitDisplay);
}

plotMode(val, data){
this.emit('plotMode', val, data);
if (val == 0){
if ($('#control-underlay').hasClass('')) $('#control-underlay').addClass('hidden');
if ($('#triggerControls').hasClass('hidden')) $('#triggerControls').removeClass('hidden');
if (!$('#FFTControls').hasClass('hidden')) $('#FFTControls').addClass('hidden');
$('.xAxisUnits').html('<p>ms</p>');
$('.xUnit-display').html('<p>'+ (xTime * downSampling/upSampling).toPrecision(2) +'</p>');
$('#zoomUp').html('Zoom in');
$('#zoomDown').html('Zoom out');
$('.xAxisUnits').html("ms");
} else if (val == 1){
if ($('#control-underlay').hasClass('hidden')) $('#control-underlay').removeClass('hidden');
if (!$('#trigger-controls').hasClass('hidden')) $('#triggerControls').addClass('hidden');
if ($('#FFTControls').hasClass('hidden')) $('#FFTControls').removeClass('hidden');
$('.xAxisUnits').html('Hz');
$('.xUnit-display').html((sampleRate/20 * upSampling/downSampling));
$('#zoomUp').html('Zoom out');
$('#zoomDown').html('Zoom in');
$('.xAxisUnits').html("Hz");
}
this.updateUnitDisplay(data);
$('#zoomUp').html('Zoom in');
$('#zoomDown').html('Zoom out');
}

_upSampling(value, data){
upSampling = value;
if (data.plotMode == 0){
$('.xUnit-display').html('<p>'+ (xTime * downSampling/upSampling).toPrecision(2) +'</p>');
} else if (data.plotMode == 1){
$('.xUnit-display').html((data.sampleRate/20 * data.upSampling/data.downSampling));
}
this.updateUnitDisplay(data);
$('.zoom-display').html((100*upSampling/downSampling).toPrecision(4)+'%');
}
_downSampling(value, data){
downSampling = value;
if (data.plotMode == 0){
$('.xUnit-display').html('<p>'+ (xTime * downSampling/upSampling).toPrecision(2) +'</p>');
} else if (data.plotMode == 1){
$('.xUnit-display').html('<p>'+ (xTime * downSampling/upSampling).toPrecision(2) +'</p>');
}
this.updateUnitDisplay(data);
}
_xTimeBase(value, data){
xTime = data.xTimeBase;
Expand All @@ -139,20 +160,39 @@ class ControlView extends View{
}
}

_triggerMode(value){
this.$elements.filterByData('key', 'triggerMode').val(value);
addGenericHandlers() {
let genericHandlers = [
"triggerMode",
"triggerChannel",
"triggerDir",
"triggerLevel",
"xAxisBehaviour",
"holdOff",
"xOffset",
"interpolation",
];
for(let n = 0; n < genericHandlers.length; ++n) {
let h = genericHandlers[n];
this["_" + h] = (value) => {
this.$elements.filterByData('key', h).val(value);
}
}
}

_xAxisBehaviour(value){
this.$elements.filterByData('key', 'xAxisBehaviour').val(value);
}

_triggerChannel(value){
this.$elements.filterByData('key', 'triggerChannel').val(value);
_holdOff(value){
this.$elements.filterByData('key', 'holdOff').val(value);
}

_triggerDir(value){
this.$elements.filterByData('key', 'triggerDir').val(value);
_xOffset(value){
this.$elements.filterByData('key', 'xOffset').val(value);
}

_triggerLevel(value){
this.$elements.filterByData('key', 'triggerLevel').val(value);
_interpolation(value){
this.$elements.filterByData('key', 'interpolation').val(value);
}
}

Expand Down
Loading