Multichron

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jamesm
 
Posts: 41
Joined: Wed Aug 12, 2009 11:42 pm

Multichron

Post by jamesm »

I'm planning to try to merge several versions of the monochron firmware together, ideally to make one version with runtime selectable behaviour.

The default firmware takes most of the space available, but there's a lot of common code between versions and I think there's a lot of room for space optimization.

Has anyone already attempted this?

User avatar
jamesm
 
Posts: 41
Joined: Wed Aug 12, 2009 11:42 pm

Re: Multichron

Post by jamesm »

I'm starting by doing memory optimizations on the original monochron firmware. So far I've made a few minor changes and saved 1310 bytes. I figure even if I can't get far enough to add in another whole clock version, the smaller code will still be useful for people who want to make new mods.

Next step will be to isolate the differences between the firmware versions and refactor the code so multiple versions can be linked in at once.

User avatar
dataman
 
Posts: 98
Joined: Wed May 20, 2009 7:03 pm

Re: Multichron

Post by dataman »

I've begun on this project, and happy to team on it. I've been working on an update to Intruder Chron, and have paired out all non essential code. I was bit dirty in the initial version and only changed what I needed to get it to work.

I was thinking about moving common elements into a library, especally the randomization routines, and allows for a call to menu of choice from the config menu.

User avatar
jamesm
 
Posts: 41
Joined: Wed Aug 12, 2009 11:42 pm

Re: Multichron

Post by jamesm »

Sounds great.

My thought was to separate all the special case behaviour into a single .c file, and add some support for calling multiple versions from the main code.

For example, I'd expect that we'd end up with anim_monochron.c, anim_sevenchron.c, etc. and all of the common code changed to call the new functions.

The major change I've made to my monochron code so far is to remove the BANNED strong PRNG and replace it with a much simpler one. You really don't need that strong a random number generator.

I haven't done any significant testing of this version yet, but here's the new code:

Code: Select all

uint32_t lcg_internal = 0;

void init_crand() {
  uint32_t temp;
  temp = alarm_h;
  temp<<=8;
  temp|=time_h;
  temp<<=8;
  temp|=time_m;
  temp<<=8;
  temp|=time_s;
  lcg_internal = temp;
}

// Linear congruential generator
// I believe these constants are from Numerical Recipies in C
uint16_t crand(uint8_t type) {
  lcg_internal = 1664525* lcg_internal + 1013904223;
  return (uint16_t) lcg_internal;
}

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Multichron

Post by adafruit »

this would be +++ rad. we would like to have 'multiple clocks' in the firmware as well! as everyone saw when we released the kit, it's a blank slate you can put anything on it since it's a clock platform, but there's not a ton of room :)

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”