[riot-notifications] [RIOT-OS/RIOT] tests/pkg_qr-code-generator: improve display speed in test application (#16466)

Alexandre Abadie notifications at github.com
Mon May 10 22:00:46 CEST 2021


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

This PR improves the display speed of the `tests/pkg_qr-code-generator` application (added #16462). In master, the QR code is sent to the display pixel by pixel, which is super slow.
This PR uses a buffer and chunks of pixel are sent to the display: the result is a super fast screen cleanup and display of the QR code. This of course comes with an extra RAM consumption but boards that provide a display usually have plenty so this is a good tradeoff IMHO.

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure

- Green Murdock
-  `tests/pkg_qr-code-generator` still works as expected and is much much faster

<details>

```
$ BUILD_IN_DOCKER=1 make -C tests/pkg_qr-code-generator BOARD=adafruit-clue flash test --no-print-directory 
Launching build container using image "riot/riotbuild:latest".
docker run --rm --tty --user $(id -u) -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/work/riot/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=adafruit-clue'  -w '/data/riotbuild/riotbase/tests/pkg_qr-code-generator/' 'riot/riotbuild:latest' make 'BOARD=adafruit-clue'    
Building application "tests_pkg_qr-code-generator" for "adafruit-clue" with MCU "nrf52".

"make" -C /data/riotbuild/riotbase/pkg/qr-code-generator
"make" -C /data/riotbuild/riotbase/build/pkg/qr-code-generator/c -f /data/riotbuild/riotbase/pkg/qr-code-generator/qr-code-generator.mk
"make" -C /data/riotbuild/riotbase/boards/adafruit-clue
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/nrf52
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/nrf52/periph
"make" -C /data/riotbuild/riotbase/cpu/nrf52/vectors
"make" -C /data/riotbuild/riotbase/cpu/nrf5x_common
"make" -C /data/riotbuild/riotbase/cpu/nrf5x_common/periph
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/disp_dev
"make" -C /data/riotbuild/riotbase/drivers/ili9341
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/auto_init/screen
"make" -C /data/riotbuild/riotbase/sys/auto_init/usb
"make" -C /data/riotbuild/riotbase/sys/div
"make" -C /data/riotbuild/riotbase/sys/event
"make" -C /data/riotbuild/riotbase/sys/fmt
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/malloc_thread_safe
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/test_utils/interactive_sync
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/sys/usb/usbus
"make" -C /data/riotbuild/riotbase/sys/usb/usbus/cdc/acm
"make" -C /data/riotbuild/riotbase/sys/usb_board_reset
"make" -C /data/riotbuild/riotbase/sys/xtimer
   text	   data	    bss	    dec	    hex	filename
  24948	    128	   7868	  32944	   80b0	/data/riotbuild/riotbase/tests/pkg_qr-code-generator/bin/adafruit-clue/tests_pkg_qr-code-generator.elf
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x00B6 --application /work/riot/RIOT/tests/pkg_qr-code-generator/bin/adafruit-clue/tests_pkg_qr-code-generator.hex /work/riot/RIOT/tests/pkg_qr-code-generator/bin/adafruit-clue/tests_pkg_qr-code-generator.hex.zip
Zip created at /work/riot/RIOT/tests/pkg_qr-code-generator/bin/adafruit-clue/tests_pkg_qr-code-generator.hex.zip
adafruit-nrfutil dfu serial --port=/dev/ttyACM0 --baudrate=115200 --touch=1200 --package=/work/riot/RIOT/tests/pkg_qr-code-generator/bin/adafruit-clue/tests_pkg_qr-code-generator.hex.zip --singlebank
Upgrading target on /dev/ttyACM0 with DFU package /work/riot/RIOT/tests/pkg_qr-code-generator/bin/adafruit-clue/tests_pkg_qr-code-generator.hex.zip. Flow control is disabled, Single bank, Touch 1200
########################################
#########
Activating new firmware
Device programmed.
sleep 2
r
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2021.07-devel-205-g47042-pr/tests/qr-code-generator-opt)
██████████████  ██████████    ██    ██████████████
██          ██  ██    ██      ████  ██          ██
██  ██████  ██  ████    ██  ████    ██  ██████  ██
██  ██████  ██  ████        ██      ██  ██████  ██
██  ██████  ██  ██████████  ████    ██  ██████  ██
██          ██    ██  ██    ████    ██          ██
██████████████  ██  ██  ██  ██  ██  ██████████████
                ██      ██████  ██                
  ████  ██  ████    ██████  ██████  ██  ██████████
  ████    ██  ████████  ██        ████          ██
  ██  ████████  ██  ██  ████                ██████
██████  ██    ██    ██  ██            ██      ██  
          ████████  ██  ██        ██████  ██  ████
  ██          ████    ██  ██    ██████    ██    ██
██    ██    ██    ████████        ██  ██    ██████
  ██    ████  ████    ██        ██  ██  ██    ██  
██      ██  ██████          ████████████████      
                ██████    ██  ████      ████  ████
██████████████  ████████  ████████  ██  ████  ████
██          ██    ██  ██████    ██      ████    ██
██  ██████  ██  ██████████      ████████████    ██
██  ██████  ██    ████  ██  ██        ████████    
██  ██████  ██  ██  ████      ██  ██    ██      ██
██          ██  ████    ██████████      ████  ██  
██████████████          ██      ██  ████      ████

SUCCESS
```

</details>

<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->


### Issues/PRs references

Follow-up of #16462 

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16466

-- Commit Summary --

  * tests/pkg_qr-code-generator: optimize display in test application

-- File Changes --

    M tests/pkg_qr-code-generator/main.c (41)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16466.patch
https://github.com/RIOT-OS/RIOT/pull/16466.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16466
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210510/3c529fac/attachment-0001.htm>


More information about the notifications mailing list