Skip to content
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

[P073] Improve display of periods in 7dtext #3460

Merged

Conversation

tonhuisman
Copy link
Contributor

@tonhuisman tonhuisman commented Jan 10, 2021

  • Optionally display periods in 7dtext command as dots on display, default disabled (= backward compatible)
  • Adds command 7ddt,<left temp>,<right temp> for dual temperature display (includes degree symbol) (removed in memory-tight configurations, only applicable to MAX7219 8-digit display)
  • Minor code optimizations (Disabling debug leaves that code out)
  • Adds option for not showing the degrees symbol with 7dt and 7ddt commands, allowing higher and lower temperatures to be displayed (>1000° and < -100°)
  • Adds option to right-align output for 7dt command (only applicable to MAX7219 8-digit display, though that may in fact be a bug)
  • Adds fonts Siekoo, Siekoo with additional uppercase 'CHNORUX' support (no support for 'ÄÖÜß' in Siekoo set) and dSEG7
  • Adds optional support for scrolling text if longer than display width can show
  • Adds support for 7dbin,<bytes>... to send any shape possible to the display. Also optionally supports scrolling if length exceeds display width
  • Settings storage redone since last beta's, so configuration has to be redone if a previous beta has been installed

Resolves #3459

Todo:

@TD-er
Copy link
Member

TD-er commented Jan 14, 2021

Is this also ready for merge? Or is it one for a next build?

@tonhuisman
Copy link
Contributor Author

I'm still working on a few extra options, mentioned in the linked issue

@tonhuisman
Copy link
Contributor Author

Last commit has a typo, P037 should be P073 😊

@TD-er
Copy link
Member

TD-er commented Jan 15, 2021

Last commit has a typo, P037 should be P073 😊

How could you mess up such a perfect numer ;)

@tonhuisman
Copy link
Contributor Author

tonhuisman commented Jan 31, 2021

I've added the requested Siekoo font, and added an extra font dSEG7 (linked in top message). For Siekoo I added uppercase versions for 'CNORUX', and left out the 'ÄÖÜß' characters, as it is very hard to send them to the unit because of character set conversion issues (UTF-8 vs ISO)

Also implemented text scrolling, where it starts with the display filled, then scrolls it off to the left until the display is empty, then restarts.

Added the 7dbin,<bytes>... command, where a set of values, matching with the bits in the display, can be sent to directly address the segments in the display, f.e. 7dbin,0B01001001,0B01100001 would display 3 horizontal lines and a small reversed c in the top half of the digit.
Mapping of the bits:
Screenshot - 31_01_2021 , 13_51_41
to the binary bitmap: 0Bhabcdefg
The values here shown in binary writing can also be passed as hex (0x prefixed, above would be 0x49,0x61) or decimal.
If the provided set of bytes exceeds the width of the display, and the scroll option is enabled, scrolling is supported here as well.

Updated device settings:
Screenshot - 31_01_2021 , 13_34_24

And the Font selection:
Screenshot - 31_01_2021 , 13_35_31

NB: Some settings have changed storage positions in the configuration file since previous betas, so have to be reviewed/corrected when upgrading a previous beta. Or remove and re-add the task 😃 When updating from the standard ESPEasy release only settings are added, so nothing to correct.

@fly74:
A beta build is here:
(See below for an updated beta)

@fly74
Copy link

fly74 commented Jan 31, 2021

@tonhuisman great I'll test it right now. Another issue I've recognized is when you use:

[7SEG1].7dtext,OUT [BLK#Temperature#d2.1]^

in a rule, the display show sometimes -0.0 or 0.0 (caused of the values I guess eg. -0.01, 0.02) is there a function for round the values?

@fly74
Copy link

fly74 commented Jan 31, 2021

@tonhuisman First test, looks good but h,H and u,U is not possible in one font set.

I would like HU. For humidity.

image

@fly74
Copy link

fly74 commented Jan 31, 2021

@tonhuisman Stop this do the job

[7SEG3].7dtext,Xv. [BLK#Humidity#d2.1]^o

image

Perfect let's put it in.

@tonhuisman
Copy link
Contributor Author

[7SEG3].7dtext,Xv. [BLK#Humidity#d2.1]^o

That ^o combo does indeed look better than the Siekoo % sign:
Screenshot - 31_01_2021 , 16_10_29

Are you saying I should add the H to the list of uppercase exceptions, so uppercase CHNORUX instead of CNORUX? (Even if that duplicates a character, or 2, it wouldn't be a problem)

the display show sometimes -0.0 or 0.0 (caused of the values I guess eg. -0.01, 0.02) is there a function for round the values?

Have you set the number of decimals for that temperature to 1? Or do you need extra decimals sending the value to a controller?
You could copy the temperature to a Dummy device set to 1 decimal, just for this reason, but first you should try to see if changing the nr. of decimals works as intended.

@tonhuisman
Copy link
Contributor Author

NB: @fly74 can you also test the Scroll text feature? It will only start scrolling when the effective text length (periods calculated correctly according to that setting) doesn't fit on the display (also calculated for TM1637 display types, though yet untested as the TM1637 4 and 6 digit units haven't yet arrived from my 'special friend' Ali 😃)
I can think of a few small improvements there, but first I'm curious if you have similar ideas

@fly74
Copy link

fly74 commented Jan 31, 2021

@tonhuisman I think we can duplicate the X and H to the same output (CHNORUX) X=H and U=V :)

The rule for the decimals is [7SEG1].7dtext,0VT [BLK#Temperature#d2.1]^ but the measure is .2 from a different esp with P2P, so rounding would be nice.

I checked the scrolling and it is nice, but I have a lot of displays, so that point to another question. Are all of the gpio ports usable for the displays? That means 2 ports shared and 14 ports (serial and i2c off) = 14 displays (I have 12 left :)) with one esp? In the tasks are not all 16 ports selectable.

Alternatively I ordered here https://www.amazon.de/MakerHawk-MAX7219-Digital-Segment-Display/dp/B07CKSKNGW ,
but what was the ALI price?

good work so far

src/_P073_7DGT.ino Outdated Show resolved Hide resolved
@tonhuisman
Copy link
Contributor Author

Are all of the gpio ports usable for the displays?

You can use an ESP32, that has more GPIO pins available (32 total, 6 reserved for Flash, 4 input-only, a couple to avoid, effectively ~20 usable). On an ESP8266 there are ~9 usable GPIO's (17 total, 6 reserved for Flash and a few to avoid using).

but what was the ALI price?

I payed $0.83 for my single item, excl. freight cost, $1.46 incl. but I had to wait a few weeks before it arrived.

good work so far

Thank you.

@tonhuisman
Copy link
Contributor Author

but the measure is .2 from a different esp with P2P, so rounding would be nice.

Or choose to display 2 decimals on temperature display? (though I think that's not really a great solution)

@fly74
Copy link

fly74 commented Jan 31, 2021

Are all of the gpio ports usable for the displays?

You can use an ESP32, that has more GPIO pins available (32 total, 6 reserved for Flash, 4 input-only, a couple to avoid, effectively ~20 usable). On an ESP8266 there are ~9 usable GPIO's (17 total, 6 reserved for Flash and a few to avoid using).

but what was the ALI price?

I payed $0.83 for my single item, excl. freight cost, $1.46 incl. but I had to wait a few weeks before it arrived.

good work so far

Thank you.

Esp32 I could never flashed with the how to.

In the task are 13 io selectable so 11 displays?

@tonhuisman
Copy link
Contributor Author

tonhuisman commented Jan 31, 2021

Fixed a few code issues, implemented PROGMEM optimization, and added a 'Scroll text in from right' option.

A new beta:
(See below for an updated beta)

@fly74
Copy link

fly74 commented Jan 31, 2021

but the measure is .2 from a different esp with P2P, so rounding would be nice.

Or choose to display 2 decimals on temperature display? (though I think that's not really a great solution)

It's not a solution the measure esp provide the value to a database and p2p. And the display should show only .1

@tonhuisman
Copy link
Contributor Author

In that case I'd use an extra Dummy Device (named Dummy and first variable named Temperature and set to 1 decimal) and change [7SEG1].7dtext,0VT [Dummy#Temperature#d2.1]^
In rules you'd have to add something like this:

on BLK#Temperature do
  TaskValueSet,12,1,%eventvalue% // Assume the Dummy is on task 12
endon

@fly74
Copy link

fly74 commented Feb 2, 2021

Oh, and I think it would be 'nice', at least for the ppl using these, to do some actual tests on 4 and 6 digit TM1637 displays, but I haven't received them yet.

@tonhuisman A basic 4 digit test can I provide.
image
@tonhuisman 4 digit shows no clock

But maybe the hw module is broken

@tonhuisman
Copy link
Contributor Author

I don't think you can combine those TM1637 displays, at least not on the same GPIO's, as they seem to use some kind of I2C(-like) protocol.
Normally dashes are shown by the plugin when the value is out of range.

@fly74
Copy link

fly74 commented Feb 2, 2021

I don't think you can combine those TM1637 displays, at least not on the same GPIO's, as they seem to use some kind of I2C(-like) protocol.

Normally dashes are shown by the plugin when the value is out of range.

The have separate GPIO's
image

@tonhuisman
Copy link
Contributor Author

First part of optimization is done (string handling during scrolling), had to disable all extra features, including fonts, for 'test' builds because of build-size issues (and still some won't fit...).
After arrival of TM1637 modules testing and further cleanup will be done.

Next task: Documentation 🤔

@tonhuisman
Copy link
Contributor Author

tonhuisman commented Feb 13, 2021

@fly74 I fixed the bug that caused the TM1637 modules to show only a few segments. (Finally received the first of a couple of TM1637 modules)
@TD-er I think that this one is ready to merge now. All TODO tasks are completed.

@fly74
Copy link

fly74 commented Feb 13, 2021

@fly74 I fixed the bug that caused the TM1637 modules to show only a few segments. (Finally received the first of a couple of TM1637 modules)

@TD-er I think that this one is ready to merge now. All TODO tasks are completed.

@tonhuisman @TD-er
👍 let's start the party

@TD-er
Copy link
Member

TD-er commented Feb 13, 2021

@fly74 You compile one for your own testing?

@fly74
Copy link

fly74 commented Feb 13, 2021

@tonhuisman @TD-er I'm not able to build but maybe ton?

@tonhuisman
Copy link
Contributor Author

I've made a build for ESP8266 (normal) and ESP32 (test) on this PR.

ESPEasy_20210213_normal_ESP8266_4M1M_test_ESP32_4M316k-P073.zip

@fly74
Copy link

fly74 commented Feb 13, 2021

I've made a build for ESP8266 (normal) and ESP32 (test) on this PR.

ESPEasy_20210213_normal_ESP8266_4M1M_test_ESP32_4M316k-P073.zip

@tonhuisman looks good but wifi can't be connected or new set. image

750 : Info : ACT : timerSet,1,1
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DOUT, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
▒U28 : Info :

INIT : Booting version: (ESP32 SDK v3.2.3-14-gd3e562907)
28 : Info : INIT : Free RAM:290888
29 : Info : INIT : Cold Boot - Restart Reason: CPU0: Vbat power on reset CPU1: for APP CPU, reseted by PRO CPU
29 : Info : FS : Mounting...
66 : Info : CRC : SecuritySettings CRC ...OK
141 : Info : INIT : Free RAM:285424
142 : Info : INIT : SPI not enabled
404 : Info : INFO : Plugins: 87 [Normal] [TEST ESP32] (ESP32 SDK v3.2.3-14-gd3 e562907)
405 : Info : EVENT: System#Wake
524 : Info : WIFI : Set WiFi to STA
615 : Error : UNKNOWN EVENT: 0
616 : Error : UNKNOWN EVENT: 15
617 : Error : UNKNOWN EVENT: 2
617 : Error : UNKNOWN EVENT: 2
725 : Info : WIFI : Start network scan
729 : Info : Webserver: start
734 : Info : OTA : Arduino OTA enabled on port 3232
747 : Info : EVENT: System#Boot
751 : Info : ACT : timerSet,1,1
865 : Info : EVENT: TaskInit#7SEG1=6,1
945 : Info : EVENT: TaskInit#7SEG2=7,1

@tonhuisman
Copy link
Contributor Author

tonhuisman commented Feb 14, 2021

looks good

As said before, it helps if I have the hardware available (and working) so I can do actual tests 😆

but wifi can't be connected or new set

That is most likely not directly related to the changes I did, but I'd expect it could be related to the many fixes (already merged into mega and included in this build) that have been done to resolve WiFi connection issues, see this issue #2931
You may have either an AP that doesn't like the changes in WiFi signal/response, or a (strange) D1 mini that doesn't positively react to these changes. So far I've only seen improvements in the response and stability of the WiFi signal on my D1 mini's and ESP32's. There is useful info in that issue (at the end of the thread, it has a lot of comments) that might help you resolve your WiFi issues.

@fly74
Copy link

fly74 commented Feb 21, 2021

@tonhuisman @TD-er So what's the timeline to get it in normal builds?

@TD-er
Copy link
Member

TD-er commented Feb 21, 2021

@tonhuisman Are you done with this PR?

@tonhuisman
Copy link
Contributor Author

Yes, all good to go 🚀

@TD-er TD-er merged commit 945d39b into letscontrolit:mega Feb 21, 2021
@tonhuisman tonhuisman deleted the feature/P073_improve_7dtext_add_7ddt branch February 21, 2021 14:02
clumsy-stefan referenced this pull request Feb 22, 2021
 [ESPEasy p2p] Add check on buffer allocation received UDP data
@fly74
Copy link

fly74 commented Feb 23, 2021

@tonhuisman Good work, works in the actual normal release!

Good Job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAX7219 add dot char to parameter "7dtext,<text>"
3 participants