From 168e1bf91d3f542ade39469b9cc5670644c35fc1 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Fri, 9 Apr 2021 08:13:54 +0100 Subject: [PATCH] README: detail Scale widget precision limit. --- DRIVERS.md | 17 +++++++++++++---- README.md | 8 +++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/DRIVERS.md b/DRIVERS.md index 50506d2..e13ddf8 100644 --- a/DRIVERS.md +++ b/DRIVERS.md @@ -444,15 +444,24 @@ On Adafruit displays, combinations that don't produce mirror images are: #### Use with uasyncio -Running the SPI bus at 60MHz a refresh blocks for 83ms. If this is acceptable, -no special precautions are required. This period may be unacceptable for some -`uasyncio` applications. Some may use lower SPI baudrates either for electrical -reasons or where the host cannot support high speeds. +Running the SPI bus at 60MHz a refresh blocks for 83ms (tested on a Pi Pico at +standard clock frequency). If the blocking period is acceptable, no special +precautions are required. This period may be unacceptable for some `uasyncio` +applications. Some may use lower SPI baudrates either for electrical reasons or +where the host cannot support high speeds, and some platforms may run Python +code at a different speed. The driver provides an asynchronous `do_refresh(split=4)` method. If this is run the display will be refreshed, but will periodically yield to the scheduler enabling other tasks to run. This is documented [here](./ASYNC.md). +The amount of data for SPI transfer for a 240x240 display is +240x240x16 = 921.6K bits +At a 60MHz baudrate this equates to +240x240x16/6e7=15.36ms +This suggests that about 80% of the latency results from the Python code. An +option may be to overclock. + ###### [Contents](./DRIVERS.md#contents) # 4. Drivers for sharp displays diff --git a/README.md b/README.md index 249b6ef..dae6d71 100644 --- a/README.md +++ b/README.md @@ -752,7 +752,7 @@ Method: * `value=None` Set or get the current value. Always returns the current value. A passed `float` is constrained to the range -1.0 <= V <= 1.0 and becomes the `Scale`'s current value. The `Scale` is updated. Passing `None` enables - reading the current value. + reading the current value, but see note below on precision. ### Callback legendcb @@ -796,6 +796,12 @@ between consecutive large ticks and legends is divided by 10. This means that the `tickcb` callback must return a string having an additional significant digit. If this is not done, consecutive legends will have the same value. +### Precision + +For performance reasons the control stores values as integers. This means that +if you set `value` and subsequently retrieve it, there may be some loss of +precision. Each visible division on the control represents 10 integer units. + ###### [Contents](./README.md#contents) ## 3.7 Class Textbox