Monochron - Change Size of Dali Clock
Moderators: adafruit_support_bill, adafruit

Monochron - Change Size of Dali Clock

by edc1591 on Mon Jul 23, 2012 9:12 pm

I'm having some trouble editing the dali clock firmware for the monochron clock.

I'm trying to make the digits smaller so that I can display the date below it. I tried changing DIGIT_WIDTH and DIGIT_HEIGHT in ratt.h, but that caused the LCD to just flash random garbage and the buzzer kept keeping.

What am I doing wrong?
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_rick on Wed Jul 25, 2012 2:17 pm

The digits are stored as bitmap images (look in the folder 'digits'). Each image is 28X64 pixels, and the values of DIGIT_WIDTH and DIGIT_HEIGHT tell the firmware the size of these bitmaps. If you change the constants, then the digit images won't be unpacked and displayed correctly.

If you want to make the digits smaller, then you will have to edit the digit image .bmp files (and change DIGIT_WIDTH and DIGIT_HEIGHT to match)
User avatar
adafruit_support_rick
 
Posts: 11613
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Monochron - Change Size of Dali Clock

by edc1591 on Wed Jul 25, 2012 5:43 pm

I just tried resizing all of the bitmaps and changed those two variables to correspond, but I'm still having the same problem.
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_rick on Wed Jul 25, 2012 6:07 pm

I know nothing about this code, but I've got one guess left. After that, you'll probably have to contact the author.

In file anim.c, there's a hardcoded 64 for the digit height in a call to blitsegs_rom:
Code: Select all | TOGGLE FULL SIZE
void drawdigit(uint8_t x, uint8_t y, uint8_t d, uint8_t inverted) {
  blitsegs_rom(x, y, zero_p+d*DIGIT_HEIGHT*4, 64, inverted);
}


Try changing the 64 to DIGIT_HEIGHT :
Code: Select all | TOGGLE FULL SIZE
void drawdigit(uint8_t x, uint8_t y, uint8_t d, uint8_t inverted) {
  blitsegs_rom(x, y, zero_p+d*DIGIT_HEIGHT*4, DIGIT_HEIGHT, inverted);
}
User avatar
adafruit_support_rick
 
Posts: 11613
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Monochron - Change Size of Dali Clock

by edc1591 on Wed Jul 25, 2012 6:19 pm

Nope, same problem. Here's a picture of what it looks like. It shows this and constantly flickers:

photo.JPG
photo.JPG (865.59 KiB) Viewed 1916 times
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_rick on Wed Jul 25, 2012 7:03 pm

XDaliChron is at least a couple of levels of modification away from the adafruit original. If you can't manage to figure it out, you'll have to try to track down the author. Here's the readme, if you haven't already got it.
Attachments
readme.txt
(1.82 KiB) Downloaded 82 times
User avatar
adafruit_support_rick
 
Posts: 11613
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Monochron - Change Size of Dali Clock

by edc1591 on Wed Jul 25, 2012 7:06 pm

That's the readme for MultiChron. AFAIK XDaliChron was written by adafruit.
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_rick on Wed Jul 25, 2012 7:28 pm

Could be. This is from before my time. The readme make it look like CaitSith2 and Dataman made the mods.
Maybe you need to run the python script to re-segment the BMPs?
User avatar
adafruit_support_rick
 
Posts: 11613
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Monochron - Change Size of Dali Clock

by edc1591 on Wed Jul 25, 2012 7:34 pm

All that does is spit out a bunch of numbers. Any idea what they mean?

Code: Select all | TOGGLE FULL SIZE
Downloaded image: BMP (24, 54) RGB
0, 5, 0, 6,
0, 4, 0, 5,
0, 3, 0, 4,
0, 2, 0, 3,
0, 1, 0, 2,
0, 1, 0, 2,
0, 1, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 1, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 1,
0, 0, 0, 2,
0, 5, 0, 6,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 1, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 1, 0, 2,
0, 1, 0, 2,
0, 1, 0, 2,
0, 2, 0, 3,
0, 3, 0, 4,
0, 4, 0, 5,
0, 5, 0, 6,
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_bill on Thu Jul 26, 2012 8:52 am

From the photo, it looks like you still are using full-size bitmaps for the digits, but you are indexing into the bitmap memory as if you had resized them.

Look at the zero: it draws full-size, but is truncated at the bottom. Then look at the 1: it gets the bottom chunk of the zero because your code thinks that is where the 1 should start.
User avatar
adafruit_support_bill
 
Posts: 29120
Joined: Sat Feb 07, 2009 9:11 am

Re: Monochron - Change Size of Dali Clock

by edc1591 on Thu Jul 26, 2012 9:24 am

I definitely resized the images. But how do the images get from the digits folder into the firmware? Do I have to compile it with some special command?
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_bill on Thu Jul 26, 2012 10:03 am

I believe you have to run the segmenter code to generate "rle.c" which gets compiled into the hex image.
User avatar
adafruit_support_bill
 
Posts: 29120
Joined: Sat Feb 07, 2009 9:11 am

Re: Monochron - Change Size of Dali Clock

by edc1591 on Tue Aug 14, 2012 10:20 am

I have the same problem when I do that.
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY

Re: Monochron - Change Size of Dali Clock

by adafruit_support_rick on Tue Aug 14, 2012 12:51 pm

The segmented output you posted earlier doesn't look right. segmented.py appears to generate some sort of runlength encoding of the bitmap. Your output really doesn't look like that. I ran segmenter.py on the original 0.bmp, and got the following (Note that the first row of 0.bmp has black pixels from 12 to 15, and the second row has black pixels from 10 to 17. The fourth row has black pixels from 8 to 11, and again from 16 to 19. You can see how that matches the output of segmenter.py):
Code: Select all | TOGGLE FULL SIZE
driverblock@ubuntu:~/Documents/CaitSith2-monochron-62c389d/firmware/digits$ ls
0.bmp  2.bmp  4.bmp  6.bmp  8.bmp  rle-in.c   segmenter.py
1.bmp  3.bmp  5.bmp  7.bmp  9.bmp  seg2rle.c
driverblock@ubuntu:~/Documents/CaitSith2-monochron-62c389d/firmware/digits$ python segmenter.py 0.bmp
Downloaded image: BMP (28, 64) 1
12, 15, 255, 255,
10, 17, 255, 255,
9, 18, 255, 255,
8, 11, 16, 19,
7, 11, 16, 20,
6, 10, 17, 21,
6, 10, 17, 21,
5, 10, 17, 22,
5, 10, 17, 22,
4, 10, 17, 23,
4, 9, 18, 23,
3, 9, 18, 24,
3, 9, 18, 24,
3, 9, 18, 24,
2, 9, 18, 24,
2, 9, 18, 25,
2, 9, 18, 25,
2, 9, 18, 25,
2, 9, 18, 25,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
0, 9, 18, 27,
0, 9, 18, 27,
0, 9, 18, 27,
0, 9, 18, 27,
0, 9, 18, 27,
0, 9, 18, 27,
0, 9, 18, 27,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
1, 9, 18, 26,
2, 9, 18, 25,
2, 9, 18, 25,
2, 9, 18, 25,
2, 9, 18, 25,
2, 9, 18, 24,
3, 9, 18, 24,
3, 9, 18, 24,
3, 9, 18, 24,
4, 9, 18, 23,
4, 10, 17, 23,
5, 10, 17, 22,
5, 10, 17, 22,
6, 10, 17, 21,
6, 10, 17, 21,
7, 11, 16, 20,
8, 11, 16, 19,
9, 18, 255, 255,
10, 17, 255, 255,
12, 15, 255, 255,
driverblock@ubuntu:~/Documents/CaitSith2-monochron-62c389d/firmware/digits$
User avatar
adafruit_support_rick
 
Posts: 11613
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Monochron - Change Size of Dali Clock

by edc1591 on Tue Aug 14, 2012 1:35 pm

Here's what mine outputs. Is it possible that I'm using the wrong segmented.py? I got it from adafruit on github.

Code: Select all | TOGGLE FULL SIZE
Evans-MacBook-Pro:digits evan$ ls
0.bmp      3.bmp      6.bmp      9.bmp
1.bmp      4.bmp      7.bmp      segmenter.py
2.bmp      5.bmp      8.bmp
Evans-MacBook-Pro:digits evan$ python segmenter.py 0.bmp
Downloaded image: BMP (24, 54) RGB
0, 5, 0, 6,
0, 4, 0, 5,
0, 3, 0, 4,
0, 2, 0, 3,
0, 1, 0, 2,
0, 1, 0, 2,
0, 1, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 1, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 1,
0, 0, 0, 2,
0, 5, 0, 6,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 1, 0, 2,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 0, 0, 1,
0, 1, 0, 2,
0, 1, 0, 2,
0, 1, 0, 2,
0, 2, 0, 3,
0, 3, 0, 4,
0, 4, 0, 5,
0, 5, 0, 6,
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 10:12 am
Location: New York, NY