Replies: 2 comments 4 replies
-
Please create a draft pull request rather than a discussion. This will allow us to comment on and review the code in addition to discussing the new feature.
I think this is the more robust option. The code to handle overflows should exist and be routinely exercised, and this accomplishes that and has the added benefit of higher timer resolution.
I assume interrupts will be disabled for the duration of the handler callback then. Can we keep them enabled and use interrupt prioritization instead? That way high priority interrupts will interrupt the lower priority ones. If this does get used to manage movement internals such as the buzzer and LED timings, they should be higher priority than watch face updates.
I haven't profiled the code yet so I don't know if we're missing or hitting that deadline. We should get some worst case cycle counts for the current version of the firmware in order to know where we're at right now and what we need to change to accomodate that real time requirement. I assume that watch faces are soft real time while watch hardware management is hard real time. Is this a reasonable assumption? Should watch faces be hard real time?
I think we should get rid of that function. The watch faces should not be blocking on the event loop like that. The code should be as asynchronous as possible. The face has access to a high precision timer, if it needs to wait some number of N Hz ticks, it should just count them and return if the deadline hasn't been reached yet. When the requisite amount of time has passed, it will know and then it can spring into action. Existing faces such as the pulsometer already count ticks that way.
And this will be completely independent of the RTC which will be running concurrently? We need power profiling to confirm that this does indeed consume less power.
Which peripheral is providing this high precision timer? I need to look it up in the data sheet. Are you using the RTC's COUNT32 mode?
I think we should invest time into getting the sensor watch hardware implemented in QEMU instead of hacking up the emscripten emulator any further. I ran into massive issues trying to test sleep modes in the latter, it would just freeze. I can't imagine it will be too reliable for developing timing sensitive firmware. I have reviewed the SAM L22 datasheet and I assume you are going to use the So the movement timer facility will feature two timers:
Is it possible to merge these two somehow? PR #345 discusses switching the I suggest multiplexing access to this @joeycastillo's concerns over the reliability of the watch must be taken into consideration. We have to ensure that the watch will not freeze or remain unresponsive in sleep mode indefinitely. |
Beta Was this translation helpful? Give feedback.
-
Speaking of precision, aren't the standard digital watch button 'mechanisms' just absolutely awful? At the cost of a great deal of time, frustration, and a Sensor Watch PCB I caused a short on, I hacked blister buttons into mine. It was extremely difficult and remains a tad sketchy, especially being a fiddle to disassemble and reassemble, because the blisters themselves are separate and held in place with a little strip of sticky tape, but the tactile buttons are nevertheless a vast improvement - aside from feeling a LOT fancier and being stupidly unique (as in, all the other watches seem stupid without tactile buttons), you know you've successfully pressed the button without watching the watch. Here's a couple of pics: https://forum.core-electronics.com.au/t/watch-out-for-the-rabbit-holes/18882/14 What would be super awesome, is if there was a PCB option to include some little unitary tactile buttons instead of the standard contacts on the PCB edge - this would require the user to cut away some of the movement's chassis, and to break off the spring tabs from the battery cover as I've done, but there's no real need for the Sensor Watch to be a reversible mod, and this would kick so much arse. |
Beta Was this translation helpful? Give feedback.
-
I am working on a new feature for the Movement framework that will help simplify faces and features that that need to measure elapsed time or trigger events in the future after short durations. I'm calling it the "high-precision timer", or HPT, and I'm working on it over at https://github.com/zzm634/Sensor-Watch/tree/hpt
Features:
New Faces:
Possible Refactors:
Outstanding questions
** 128hz: can use the 32-bit timer register directly without having to worry about overflows. Running at 128hz, a 32-bit counter will overflow in 1.06 years, by which time the battery will probably have died. The counter will be reset to zero and powered off when no faces are using it, so unless someone is continuously running a stopwatch for more than a year, this is unlikely to be a problem.
** 1024hz: will need a combination of the 32-bit timer and an overflow interrupt to manually store a separate count of overflows. Timestamp would be 64-bit (though probably actually only 40 bits), and scheduling tasks will be more complicated. However, faces would never have to worry about encountering an overflow. 2^40 ticks at 1024hz is 34 years, and the battery will definitely be dead by then.
Concerns:
Benefits:
TODO:
Beta Was this translation helpful? Give feedback.
All reactions