-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to draw QR codes #156
Open
mphasize
wants to merge
9
commits into
noopkat:master
Choose a base branch
from
blokdots:draw-qr-code
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
…ith multiple boards. When working with multiple boards, Johnny Five can get confused which board to use. By using the optional `board` parameter and passing the board variable used to initialize Oled, we can fix that.
When building the Johnny Fives types, we get the error: ``` node_modules/@types/johnny-five/index.d.ts:663:21 - error TS1005: ',' expected. 663 song: [frequency: string | null, duration: number][]; ``` Upgrading to Typescript 4.x solves this issue.
When building with Typescript 4 we get the following build error for all private properties and functions: ``` oled.ts - error TS4094: Property '[all private variables and functions]' of exported class expression may not be private or protected. ``` If I read this issue correctly, the `private` definition is not really supported, so I'm commenting it out for now.
We need the build output in order to reference this branch directly in a package.json file. If the PR is merged and released, these files can be removed again.
Since the most current version of serialport is >10 and the serialport dependency seems to be unused in this repo, let's remove it.
If we want to optimize drawing calls, we can use the sync/immediate flag to turn immediate updates off and then only update changes bytes in the last drawing call. However, instead of always checking the flag on the last call, we could also use the updateDirty method as the last function call which would make fiddling with other draw calls a little easier.
…m on the display Uses an optional dependency `qrlite` to encode the data string as a QR bitmap.
It seems like qrlite would produce invalid QR codes as not all codes I tried where recognized. The qr-image library seems to work more reliably.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this PR attempts to add a new function to draw QR codes on the OLED display. It builds on the external dependency qrlite to generate the QR codes and then draws them with a little frame on the display.
Here's the documentation I added to the README file.
drawQRCode
Draws a QR code with a frame around it on the display. Needs the optional dependency
qr-image
to be installed for generating the QR code as a bitmap. In testing only the error correction level "Q" produces working QR codes and only strings are accepted as data for the QR code.Arguments:
Optional bool as last argument specifies whether screen updates immediately with result. Default is true.
Usage:
This PR builds on top of my other PR and is not cleanly isolated. Please consider it as a proposal and, if interesting, I'm happy to clean up the PR. If such a function is considered out of scope, you can also just close the PR.