jakkra / ZSWatch

ZSWatch - the Open Source Zephyr™ based Smartwatch, including both HW and FW.
https://forms.gle/G48Sm5zDe9aCaYtT9
GNU General Public License v3.0
2.38k stars 207 forks source link

Add RTC to firmware #318

Closed Kampi closed 2 months ago

Kampi commented 4 months ago

Closes #309

Kampi commented 4 months ago

@jakkra we have to modify the RTC patch and replace

    if (regs[0] & RV8263_BM_OS) {
        return -ECANCELED;
    }

with

    /* Clear the oscillator stop flag and return an error when the oscillator is stopped. */
    /* The flag is set again if the error condition for the oscillator is still active. */
    if (regs[0] & RV8263_BM_OS) {
        regs[0] &= ~RV8263_BM_OS;
        i2c_reg_write_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_SECONDS,
                              regs[0]);
        return -ECANCELED;
    }

What´s the best way to do it? Can I simply copy+paste this code into the patch?

jakkra commented 4 months ago

@jakkra we have to modify the RTC patch and replace

    if (regs[0] & RV8263_BM_OS) {
        return -ECANCELED;
    }

with

    /* Clear the oscillator stop flag and return an error when the oscillator is stopped. */
    /* The flag is set again if the error condition for the oscillator is still active. */
    if (regs[0] & RV8263_BM_OS) {
        regs[0] &= ~RV8263_BM_OS;
        i2c_reg_write_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_SECONDS,
                              regs[0]);
        return -ECANCELED;
    }

What´s the best way to do it? Can I simply copy+paste this code into the patch?

Idk, try it, see if patch applies correctly otherwise can regenerate the patch

Kampi commented 3 months ago

@jakkra I´ve updated the RTC patch to the latest version from Zephyr to handle the issue with the alarms.

jakkra commented 3 months ago

@jakkra I´ve updated the RTC patch to the latest version from Zephyr to handle the issue with the alarms.

OK great, will test it. Should everything work if I rebase on this branch or do I need to do something more?

Kampi commented 3 months ago

I´ve tested it before the new patch and time and update are working. The changes are related to alarms which wasn´t tested by me but I don´t expect any issues.