zerog2k / stc_diyclock

STC DIY Clock redux (STC15F204EA, STC15W404AS, STC15W408AS)
MIT License
171 stars 66 forks source link

Heavily optimized - added seconds display - MMDD/DDMM switch #6

Closed jjmz closed 8 years ago

jjmz commented 8 years ago

Jens,

After some days working on the code, here is a PR that hopefully does not break the current implemented functions, and adds seconds&DD.MM display switch (more common here in FR). Basically, I removed rtc/config in function parameter when calling the ds1302 functions, replaced the struct by direct access to the data (replaced rtc/config structs by table[]) since the 8051 generated code for access to structs is not really optimal (although it is more readable and elegant I admit). I am still not very happy with the behaviour of switch/keypress code, so that's my next target... Also I think there is now code space to add the chime&alarm (perhaps DCF77 too, but I still have not connected my module...). Best regards, JJ

zerog2k commented 8 years ago

thanks. great work so far... I'll test this out tonight or tommorow on my clock and merge if no issues found..

I also am not too happy with my software debouncing (they should have used simple hw debounce, but sadly they overloaded the uart pins :( - I'm confident you can improve the UX in this area... Also looking forward to alarm/chime implementation - with the optimizations you have made, there should be plenty of room for this, and may another trick or two the original firmware doesn't have ;)

zerog2k commented 8 years ago

Oh, also, do you want to make a readme note about any features/changes? Also, add your name to the headers as a contributor if you like...

jjmz commented 8 years ago

On my current master, I have taken into account your comment regarding the use of #defines for MASKs. I have also put the %4, as there is no difference with code generated by sdcc >3.3.0. Please test first, and if you feel adding the new functions to the readme is appropriate, please do so. You already mentioned my work in the readme around the stc15, so it is fine with me (by the way, I should put this code on git too.)

zerog2k commented 8 years ago

Ok, I tested that it works - due to above mentioned "feature" of stcgal, it works ("eeprom" section is flashed), but also as mentioned, it does NOT work (display is blank - no numbers, only dots) when programmed w/ stc-isp, as it will "truncate" it and not try to program "eeprom" range from code. Perhaps we can output the led table to separate eeprom.hex file that can be programmed with the lookup tables, for anyone using windows + stc-isp.

zerog2k commented 8 years ago

ok, i have a solution to make eeprom (for stc-isp folks) with simple sed command I'll add to makefile and update readme...

Will go ahead and merge this now.. Thanks.