Skip to content

Commit

Permalink
only sent serial output if connected
Browse files Browse the repository at this point in the history
  • Loading branch information
hall committed Jun 18, 2023
1 parent 47e42dd commit 20c0ee5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- filter file uploads by `.mxl` extension

### Fixed

- serial output no longer sent if cursor has not moved or port isn't connected

## [0.2.0] - 2023-06-15

### Changed
Expand Down
8 changes: 5 additions & 3 deletions src/app/services/notes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class NotesService {

// write number to serial output
async serialWrite(note: number) {
await this.writer.write(this.encoder.encode(note.toString() + '\n'));
if (this.port) await this.writer.write(this.encoder.encode(note.toString() + '\n'));
}

clear(): void {
Expand Down Expand Up @@ -195,8 +195,10 @@ export class NotesService {
key.voice = voice.ParentVoice.VoiceId;
key.finger = note.Fingering ? note.Fingering.value : '';
key.grace = note.IsGraceNote;
key.required = true;
this.serialWrite(this.keys.indexOf(key));
if (!key.required) {
key.required = true;
this.serialWrite(this.keys.indexOf(key));
}

// in case of tie, check that it is a start note
if (typeof note.NoteTie === 'undefined' || note === note.NoteTie.StartNote) {
Expand Down

0 comments on commit 20c0ee5

Please sign in to comment.