Closed jcmadrioso closed 3 years ago
I have the same issue too. It seemed to me that some displays either have the semi-colon or the dots, according to some research i did on the web. Did it work before the latest update?
No, with the former version displaying "1.65" the result is "1 :65" with a blank between 1 and : (my display only have a semi-colon). Trying to display "12.65" results in "2 :65"
I think that the problem is in file TM1637.h, line 77 and following. It is necessary to detect the dot character, then set dp in that position and not decrement position in buffer.
I have had this issue before. Some displays don't let the user enable the dot led other don't let enable the colon (Google search). This is usually also mentioned somewhere on the purchase page. In the source code 1.23 would turn to "1.23", then to their appropiate ASCII code, then to the 7 segment display's equivalent. '.' turns to 0x80 = 0b1000000. To turn on the dot LED. This turns the colon LED because your (mine too) version of the display is built as so. For others it will turn the dot LED on.
Yes, I agree, dot is eight bit in the display, that must be "or-ed" with the 7-segment code to display the digit and turn the dot on.
About the "or"-ed part. Yeah i thought of it, but i found it nicer to have a separate spot for the dot entirely. I suppose i could change this during the next update.
The problem, I think, is that a "." in the argument of display method is leaving a blank because expected variable is decremented anyway.
I think i am misunderstanding you. It is to be expected that there is a blank digit, because the program sends 0x80 to the display to enable the dot LED, but because the display hasn't actually connected the dot LED, nothing happens (blank digit). However, for 1.23, the dot is at position 2. So 0x80 sent at digit 2 turns the colon on, instead of the dot because your display and mine only support the colon. On other displays, it would have turned the dot LED on.
Could you maybe implement what you are trying to tell me and submit a pull request if you have time? I still don't understand.
Yes, the dot led should be turned on, but only the dot, not the others leds of the segments. I will try to implement it.
I am more confused than ever. The displayRawBytes() method could be used: What should happen if i did:
#include <TM1637.h>
TM1637 tm;
void setup()
{
tm.begin();
}
void loop()
{
tm.displayRawBytes({DisplayDigit().setDot()}, 1);
delay(5000);
}
? Nothing. Do you mean that something else should happen, on our display?
There are two types of 4 digits 7 segment displays, please find photo attached. On first kind you can use colon and on the second kind you can use dot for each digit. Please find photo with all possible segments turned on. I think if you define, that you have display with dots, it should work different for floats. For example if you want to display 12.3 it should display [1][2.][3][ ] and not [1][2][.][3]
Ok. I will change it.
Added. Can you test it?
I tried and it works. I also checked with padding and offset. I think that you can close this issue :)
Yup. Thanks.
Hi, I am facing a similar issue, but with a screen with both dots and colon. The library uses a colon as a dot for decimals. The colonOff() won't work. I would like to know how to implement a solution, maybe one that specifies the type of screen (dot, colon, both)
Interesting ... Does displaying floating point values with decimal digits work?
Does colonOn()
work? Does switchColon()
work? Could you share a link of where you bought the display?
Interesting ... Does displaying floating point values with decimal digits work? float x = 3.132 is represented as 31:32 Does
colonOn()
work? DoesswitchColon()
work? Could you share a link of where you bought the display? Nothing changed between display(), colonOn() and switchColon() The link is this
A priori, i would say that the display from the link that you have provided doesn't support decimal digits (Even though they are physically present).
Could you try the clock
example and tell me if the colons blink?
That could be the case. I have tried the clock example: at first, it varies, I have recorded a video
Wow cool video. The program is working as expected. What did you mean with "it varies"?
As far as i know the TM1637 can only either support the decimal LEDs or the Colon. (Had to learn the hard way. It is usually mentioned on the decription page of the display). One way to similate a dot/decimal LED, is to use a space: 1.23 => 1 23. Or 1.23 => 1_23 .
"It varies" is part of a comment I deleted sorry! I can see the switch only works if there is something displayed on the second digit. Maybe I should consider another display. I pretend to represent natural numbers (4-digit co2 measurements), clock-like (with colon), and dot (for temp readings, 23.10)
"It varies" is part of a comment I deleted sorry! I can see the switch only works if there is something displayed on the second digit.
Maybe I should consider another display.
You could get the same display, just with dot support instead.
I pretend to represent natural numbers (4-digit co2 measurements), clock-like (with colon), and dot (for temp readings, 23.10)
A hot fix would be to convert the values to string, modify them, then display. Something like so (untested).
String convertValue(double value)
{
String val = value;
val.replace(".", "_");
return val;
}
then
tm1637.display(convertValue(1.1));
Weird that the switch works if there is something displayed on the second digit. I will take a look at what is happening later.
Typ => Original value => on Display
pad => 1 => 1000 offset => 1 => 01 overflow => 1334443 => 1334443
Try the example custom_digit
Thank you very much for your help. Now I have it clear what I can do and what not. I will do something as you describe to replace the dots (which clearly don't work by any means). A display with dot support will lack colons right? At least using this TM1637 chip.
Thank you very much for your help. Now I have it clear what I can do and what not. I will do something as you describe to replace the dots (which clearly don't work by any means).
Welcome.
A display with dot support will lack colons right? At least using this TM1637 chip.
I think so. Read the schematic of the TM1637. It can multiplex either the colon or the dots. Despite this, the display still comes with both, probably to save manufacturing costs.
When displaying a floating point value (12.3456, f.e.), a blank digit is displayed instead of decimal point.