HM 4.0 Display options


 
I am interested in using a larger display on my heatermeter so that i can display all 4 probe temps at the same time. Longer term it might be nice to use the extra real estate to be able enter probe types without using the serial interface. According to Bryan Mayland:
The display code is in hmcore.cpp updateDisplay() function. The easiest thing to do without adding a ton of progmem usage would be to just have it loop through the probes and use the existing formatting functions instead of just outputting the one probeIndex. I know a lot of 4 line displays are also 20 characters wide but having different formats for 16 vs 20 character widths means big changes all over the place to support it so keep that in mind.

So for starters to not affect anything existing, I would like to add an additional mode for 4 line, how does HM control what display mode it is using? There is a selector for 2 line and all the big number modes. How does this work, is there a variable that contains the mode then based off the value an if/then/else writes different data to the display?


Known working displays:
PINHD-1X16 from Mouser or Digikey
HD44780 based 20x4 line displays

*Please note that to connect the display directly to the HM4 header, you must get an LCD with the connector below the display(pin1 on the left and pin16 on the right when viewed from the top). Some LCDs only have one connector above the display, to use this you would need a ribbon cable or relocate the 4 way button on the HM4.
 
Last edited:
The 4-line display is in github now, although the code to turn it on from the website is on my development machine which is currently trashed. If you build and flash the heatermeter code, you can switch to 4-line home with the raw set command of lb=,254 or lb=,255 (yes, lb equals comma) to switch it back to 2-line.
 
The 4-line display is in github now, although the code to turn it on from the website is on my development machine which is currently trashed. If you build and flash the heatermeter code, you can switch to 4-line home with the raw set command of lb=,254 or lb=,255 (yes, lb equals comma) to switch it back to 2-line.

Thanks Bryan, i really want to understand how this is works, the lb=, command, is this the lock bits for the arduino? And the lsb for that byte toggles 2-line vs 4? Is this what you are using to select the big number displays as well?

Well it looks like that byte does control the big number displays and the lb=, passes a byte to a variable as follows? Then the print routine looks to that variable to determine which print mode?

lb=,255 2 line
lb=,254 4 line
lb=,0 Big Probe0
lb=,1 Big Probe1
lb=,2 Big Probe2
lb=,3 Big Probe3
 
Last edited:
The lb= is a HeaterMeter set command, in handleUrl() which calls errr storeLcdParam() with index 1 which stores the value in g_HomeDisplayMode (and eeprom). This variable is referenced in updateDisplay() which is called when there is a temperature update (once per second) and also when you switch to any HOME menu (either via the rotating probe display timeout or button press).

If g_HomeDisplayMode is 0-3 it output bignum and exits. If g_HomeDisplayMode is 255 it sets the low and the high indexes of probe to display to the same value so it only prints one probe. If g_HomeDisplayMode is 254 (fallthrough) it sets low and high to FOOD1 - AMB and so the loop writes them all out on each line.

This is all off the top of my head so the names might night quite match up.
 
Got ya, thank you for the explanation and the folloring determines of the value is set to 0-3?

if (g_HomeDisplayMode >= TEMP_PIT && g_HomeDisplayMode <= TEMP_AMB)

I see where you added the 4 line code, I am still confused as to how this writes the values for all the probes. It's probably syntax and the newer programming languages that has me tripped up. I understand the If/then/else to determine which mode to display but then how the output gets sent to the print function loses me. Does the entire display get updates all at once or are certain values overwritten as they change?
 
Yup that's the bignum bit, looking for 0-3. The section that says // Rotating probe display is the part that does either 1 probe (because the low and high were set to the same value above) or all 3 non-pit probes. It sprintf()s it to the local buffer (which makes sure that everything is lined up properly) then set the line number in the lcd with setCursor() and then writes the whole line from buffer. The entire display is refreshed all at once regardless of if any value has changed.
 
Got the code pushed to my test system and the 4 line mode does switch the display. However, it doesn't show temps for probe 2 and 3, just probe name.
 
Last edited:
That's strange, because it shows temperatures and probe names for all them for me. I haven't tried a cold boot though, I wonder if that makes a difference.
 
I don't see why it would. I'll keep tinkering, it may be my display although it doesn't really make sense that the last 2 lines would be different than the 1st 2. I have noticed that on all display modes other than the temp status page it clips off the leftmost character. I'll get another display and try again.

As before, thanks Bryan.

Oh, and in browsing the code, i didn't realize all the old wishield code was still in there. Seems like eons ago we were using that.
 
Bryan, I see they you updated the conf.htm in github so I updated to LinkMeter package version 4 but still don't see the 4 line option as selectable. I've tried different browsers so i don't think it's a cache issue. Where is the conf.htm in the filesystem I can check it? I did try a find conf.htm but nada.
 
Yeah 4 line isn't select-able in version 4, it came after that. The path is /usr/lib/lua/luci/view/linkmeter/conf.htm

I also couldn't reproduce the problem you're having with the temperatures not showing up. Within a second of me plugging a probe in, it showed on the display with a value. None of the values are cut off either. /shrug
 
Weird, On the main display page, the 2 bottom lines are probe name only, center justified. The non all other display screens, the top line is shifted one to the left cutting off the 1st character. To install, I downloaded the entire /arduino section from github( with libraries), compiled and flashed via FTDI. Wonder what i did wrong.....

https://plus.google.com/u/0/photos/103516610817493464039/albums/posts/5842247063079949410

@ RJ
Where did you get the 4 line display?
 
@ RJ
Where did you get the 4 line display?

Got it off ebay a year or so ago. I think it was about $8.
Mouser has a Newhaven for $18.10
And here's one on eBay

20x4 displays are fine as long as line 3 and 4 start at 0x44 and 0x54 respectively. I did see a cool 20x4 on adafruit with RGB backlight tho, thought that could be really cool to tie in the different colors to the led indicators on the HM4 board.
 
Last edited:
The only reason I have one is because I was looking for something else on eBay and came across this incredible deal for 20x4 LCD displays. I couldn't pass up 4 for $7.67 each shipped. They're incredibly high quality and retail for $35 from mouser. Their response time is a LOT faster than the NewHaven from the parts list, and they're transreflective so you can read them even with the backlight off.

RJ: It looks like your display has the display memory map different than others. Basically when you write to the LCD at 0,0 it puts a byte in video ram at location 0x0. When I say "move the cursor to col 0 row 2" really what you send it "set ram address to 0x14". The ram is actually layed out contiguously such that if you keep writing on row 0 you'll show up on the third row and if you keep going from there you'll show up on the second row then the fourth. It looks like your memory isn't laid out like this:
Row 0: 0x00
Row 1: 0x40
Row 2: 0x14
Row 3: 0x54

Which are the constants used by all the LCD libraries. You can adjust this in ShiftRegLCDBase::setCursor() and see if that fixes it. Looks like your row 2 is 0x10 and your row 3 is 0x50?
 
Yeah, that makes sense Bryan, unfortunately i haven't been able to get a spec sheet on this one. There are a couple traces on the back that appear to be optional jumpers but without the specs?????? Does the data format correctly with a 20x4 display? I really like that RGB one over at Adafruit.
 
Now that i think about it, the memory addresses above have to be for 20 char displays. For 16 it would be row 1 0x0-0x0f, row 3 0x10-0x1f.
 
Haha There is a 20x4 LCD here at work with a bunch of jumpers on the back too. Lord knows what they do. The data looks fine on my 20x4, and I didn't have to change a thing in the LiquidCrystal library so that leads me to believe that this is how the majority of 4 line LCDs work.

I've used one of those RGB lcds in another project. They're pretty great but to reach their potential you need to PWM the LEDs to get the colors you want. I drove them directly from Arduino pins which seems to work fine. I think I used current limiting resistors.
 
Now that i think about it, the memory addresses above have to be for 20 char displays. For 16 it would be row 1 0x0-0x0f, row 3 0x10-0x1f.
Yeah except 16 character displays use the same memory layout. The HD44780 chip only supports 2 rows of 40 characters each, and somehow someone decided they'd just divide that into 4 rows of 20 characters each as an extension.
 
OK I found a spec sheet online. Gee, there were only 10 different part numbers on the back of this thing ;)
So it's a Seiko L1634 and id does say line 3 is 0x10-ox1f with so that explains everything with the shift of the bottom 2 rows.

I modified ShiftRegLCD.cpp line 114 as follows and my 16x4 works fine now.

Code:
  const uint8_t row_offsets[] = { 0x00, 0x40, 0x10, 0x50 };

I guess the simple solution for me is to just get a 20x4 which there seem to be a lot more of anyway or if someone wants to use a 16x4, make sure that the memory map starts line3 at 0x14 and line 4 at 0x54.
 
Last edited:

 

Back
Top