-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Create pulse plotter from Flipper * feat: Add alias for composables * feat: Add composable useNumberOnly * fix: Deleted unnecessary code * refactor: Changed syntax * feat: Added a limit on entering numbers * feat: Added destroy worker when leaving the page --------- Co-authored-by: Maxim Lyubimov <[email protected]>
- Loading branch information
Showing
18 changed files
with
3,045 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/node_modules | ||
.eslintrc.js | ||
babel.config.js | ||
quasar.conf.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"arrowParens": "always", | ||
"bracketSameLine": false, | ||
"bracketSpacing": true, | ||
"embeddedLanguageFormatting": "auto", | ||
"endOfLine": "lf", | ||
"htmlWhitespaceSensitivity": "css", | ||
"insertPragma": false, | ||
"jsxSingleQuote": true, | ||
"printWidth": 80, | ||
"proseWrap": "preserve", | ||
"quoteProps": "as-needed", | ||
"requirePragma": false, | ||
"semi": false, | ||
"singleAttributePerLine": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"useTabs": false, | ||
"vueIndentScriptAndStyle": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<template> | ||
<div id="flipperPlotter" class="full-width q-mb-md" /> | ||
<div class="full-width"> | ||
<div class="row q-col-gutter-md q-mb-md"> | ||
<q-select | ||
class="col-1" | ||
v-model="currentSlicer.modulation" | ||
:options="slicerOptions" | ||
option-value="value" | ||
option-label="text" | ||
emit-value | ||
label="Slicer" | ||
/> | ||
<q-input | ||
class="col-1" | ||
v-model.number.trim="currentSlicer.short" | ||
@keypress="useNumbersOnly" | ||
type="text" | ||
label="Short" | ||
/> | ||
<q-input | ||
class="col-1" | ||
v-model.number.trim="currentSlicer.long" | ||
@keypress="useNumbersOnly" | ||
type="text" | ||
label="Long" | ||
/> | ||
<q-input | ||
class="col-1" | ||
v-model.number.trim="currentSlicer.sync" | ||
@keypress="useNumbersOnly" | ||
type="text" | ||
label="Sync" | ||
/> | ||
<q-input | ||
class="col-1" | ||
v-model.number.trim="currentSlicer.gap" | ||
@keypress="useNumbersOnly" | ||
type="text" | ||
label="Gap" | ||
/> | ||
<div class="col-2 flex"> | ||
<q-btn | ||
color="primary" | ||
icon="content_cut" | ||
label="Slice" | ||
size="md" | ||
unelevated | ||
@click="onSlice" | ||
/> | ||
</div> | ||
</div> | ||
<div class="column"> | ||
<div ref="timings" class="q-mb-md" /> | ||
<div ref="bits" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { onMounted, ref, watch, defineProps, onBeforeUnmount } from 'vue' | ||
import { FlipperPlotter } from 'util/flipperPlotter/flipperPlotter.js' | ||
import { FlipperPlotterOffscreen } from 'util/flipperPlotter/flipperPlotterOffscreen.js' | ||
import { useNumbersOnly } from 'composables/useNumberOnly.js' | ||
const props = defineProps(['data', 'offscreen']) | ||
const timings = ref(null) | ||
const bits = ref(null) | ||
const plot = ref(null) | ||
const slicerOptions = ref(null) | ||
const currentSlicer = ref({ | ||
modulation: '', | ||
short: 0, | ||
long: 0, | ||
sync: 0, | ||
gap: 0 | ||
}) | ||
const onSlice = () => { | ||
plot.value.setSlicer(currentSlicer.value) | ||
} | ||
const draw = () => { | ||
const config = { | ||
data: props.data, | ||
timings: timings.value, | ||
messages: bits.value | ||
} | ||
if (props.offscreen) { | ||
plot.value = new FlipperPlotterOffscreen(config) | ||
} else { | ||
plot.value = new FlipperPlotter(config) | ||
} | ||
slicerOptions.value = plot.value.slicerOptions | ||
currentSlicer.value = plot.value.slicer | ||
} | ||
onMounted(() => { | ||
draw() | ||
}) | ||
watch( | ||
() => props.data, | ||
() => { | ||
plot.value.destroy() | ||
draw() | ||
} | ||
) | ||
onBeforeUnmount(() => { | ||
plot.value.destroy() | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function useNumbersOnly (evt) { | ||
const charCode = (evt.which) ? evt.which : evt.keyCode | ||
if ((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode !== 46) { | ||
evt.preventDefault() | ||
} else { | ||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.