Added support for TM1637 displays#252
Conversation
Replaced stock LedControl library with dual MAX/TM library; increased display number for smaller Arduinos from 1 to 3
|
Firmware for this pull request: |
|
After my vacation I now started to have a look on this PR. Just a short questions, a TM1637 is identified if no Up to now we have a "own" library for the MAX segments. Do we change the library or do we keep the new files under I haven't build my own opinion for now... |
|
Oh, and another one. Which value is coming from the connector for a undefined pin? I was thinking about this when working on the custom device. I thought about 0x-1 or 0xFF. 0xFF could be a problem as some(all?) pins are handled as 8bit integer, but I have to check this again. /edit: However, it's a clever idea to handle TM1637 displays this way! /edit2: OK, I guess I got it. If pin CS has a valid pin (< 0xFE) than it is a MAX display. If CS is 0xFE it is a 6digit and if 0xFD it is a 4 digit TM display. But why is the function |
|
Hi @elral, hope your vacation went great!
More precisely, if it has a "magic" value - see next reply
The stock
Exactly, as per the modified |
Pins are managed internally as
That's a safeguard: it also covers the case of CSpin = 0xFF (theoretically never happening, at least currently). That's because uint8_t 0xFF + 1 = 0x00, which - albeit now meaningless - would correctly identify as not a TM1637. |
|
Hi @GioCC,
Yes, it was! Thanks!
This library is forked and is therefore under our own control. Compared to the original one there are some modifications done. So the changes could be implemented in our fork, but as there are now new functions I would keep it as it is now. Compared to other devices the naming of the files is not really consistent. We should take the chance to have it like the other devices. LED in the filename is not required anymore as the functions to control a single LED on the MAX are all deleted (instead of not used per #define up to now).
I haven't looked in detail to the
There is no modified
Unfortenutely not always, see
If CSpin is 0xFF this pin is uninitialized according your definition Shouldn't we use In Regards Ralf |
|
Firmware for this pull request: |
|
Hi @elral, see my replies below.
Yes, but I said "out of our code space" (meaning of the current project), not "out of our control".
By "as it is now" I gather you mean you mean "as in the PR"?
It is a library specifically for 7-segments LED displays, so I don't see anything wrong by referencing LEDs. But of course neither does that prevent from naming it differently.
This could be an option. But then to me it would make more sense to leave
Anyway, this name change would not really have to do with any change made by this PR, and if anyone is inclined to do it, it could be done as a separate PR, as is usually the case.
That would be the most meaningful place IMHO. I would have placed it there first, had I not expected a discussion on these topics anyway.
Ugly. If something meaningful is desired, it should be on the lines of "DualLEDDisplayDriver.*".
Yes, as I said, the MAX part is basically unchanged from the stock one (except also for unused parts removed for clarity and possible interference).
You're right, I inadvertently didn't include it because I had also temporarily disabled the Pico part. Fixed now.
That's another layer, and it simply passes the values transmitted (also as generic
First, I don't think that's appropriate; functions at this level are agnostic with respect to values passed, and a wider type is necessary to accomodate different value ranges, both present and future.
Exactly. But since the check is used anywhere only to detect TM displays, the most correct version (regardless for the naming) is the one that ONLY "passes" TM codes.
Agreed. And unfortunately checks cost Flash space, so it would not be the only place were we want to rely on a certain degree of correctness of other code.
Which, as I explained above, looks nicer but it would be even less correct and in the end more dangerous.
We could. It was that way in the original LedControl.
In this case I disagree. These are not alternate versions of the same code; these are two distinct pieces of code, each made available in a different build configuration. BTW, on a more substantial note (which I think are more relevant topics to discuss): The The Thanks again for your feedback, I'm looking forward to further observations! |
|
For reference, see alco comment MobiFlight/MobiFlight-Connector#1252 (comment) |
|
Firmware for this pull request: |
|
Firmware for this pull request: |
|
Firmware for this pull request: |
| // --- .d | ||
| // D | ||
|
|
||
| const static byte charTable[128] PROGMEM = { |
There was a problem hiding this comment.
We could also save some space if we don't use the first 4 lines. We would just to make sure that we are always requesting actual chracters > 32
Replaced stock LedControl library with dual MAX/TM library; increased display number for smaller Arduinos from 1 to 3
Description of changes
Fixes #251
Adding these units as new, independent devices is almost unfeasible because of memory (mainly flash) constraints on the smaller (Arduino) boards.
This implementation extends the standard MAX72xx LedControl driver with a dual low-level layer, keeping perfect compatibility in the upper interface layer; this way, it doesn't call for the overhead of an additional device type, and also it doesn't require changes in the message set.