raggedpi / narcoleptic Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/narcoleptic
Automatically exported from code.google.com/p/narcoleptic
with int delay, aren't we limited to 60 seconds roughly ?
i need to wake up every 10 minutes or more, I changed to long and it seems to
be working pretty fine
Original issue reported on code.google.com by [email protected]
on 22 Mar 2014 at 11:11
Attached the patch for support ATTinyX5 family.
Original issue reported on code.google.com by [email protected]
on 17 Oct 2013 at 2:36
When compiling on atmega 8 errors apears Can it be fixed?
Original issue reported on code.google.com by [email protected]
on 29 Jul 2010 at 11:20
Do you plan to migrate this project to another place?
I would like to know its future.
Thanks
Original issue reported on code.google.com by [email protected]
on 21 Apr 2015 at 6:13
The library is imported into project - no problem. The call to the delay
method executes without error but I see no evidence that the thing is going to
sleep. I have monitored its current draw at ~17 mA and noted that it does not
drop at all. Any ideas would be greatly appreciated.
Original issue reported on code.google.com by [email protected]
on 31 Jul 2013 at 1:33
Narcoleptic's delay interface is defined as
void delay(int milliseconds);
I propose to make it: void delay(uint32_t milliseconds);
Current implementation has a maximum of ~32767 milliseconds sleep() ==> ~half
a minute
Proposed interface has a maximum of ~4294967296 milliseconds sleep() ==> ~49.7
days
Proposed interface is backwards compatible, and makes narcoleptic delay()
interface identical to Arduino's delay().
Costs : 2 bytes
Original issue reported on code.google.com by [email protected]
on 16 Sep 2013 at 11:19
Very comfortable library. It would be possible to save a little more power,
even if AD converter would be switched off.
# ifndef cbi
# define cbi (sfr, bit) (_SFR_BYTE (sfr) & = ~ _BV (bit))
# endif
# ifndef sbi
# define sbi (sfr, bit) (_SFR_BYTE (sfr) | = _BV (bit))
# endif
[...]
NarcolepticClass :: void delay (int milliseconds) {
cbi (ADCSRA, ADEN);
[...]
sbi (ADCSRA, ADEN);
}
Original issue reported on code.google.com by [email protected]
on 14 Jul 2013 at 8:08
What steps will reproduce the problem?
1. call Narcoleptic.delay(10)
What is the expected output? What do you see instead?
Expected: MCU should sleep for 10ms and then resume working
Actual outcome: MCU freezes apparently - in reality the counters in delay
method underflow/overflow and MCU sleeps for ~15 minutes.
The problem is in these 2 lines in delay():
microseconds -= watchdogTime_us;
if (microseconds > 0) {
- microseconds variable is defined as uint32_t, so it can never be negative -
if the requested delay is shorter than watchdog time, it gets a very high value
(which will again overflow in 16-bit sleep_periods).
Solution would be to change the two lines above to:
if (microseconds > watchdogTime_us) {
microseconds -= watchdogTime_us;
- functionally the same, only without annoying freezes ;-)
It might also make sense to change milliseconds parameter to uint32_t for
sleeps longer than ~32s, and also same for sleep_periods to get it over ~15
minutes (maximum sleep time would then be some 1h15m).
I'm attaching the patch with all my local changes, if anyone's interested
(can't push it directly into the repo):
- fixed microseconds underflow bug in delay()
- delay() parameter changed to uint32_t with microseconds overflow protection
- sleep_periods changed to uint32_t
Original issue reported on code.google.com by [email protected]
on 28 Apr 2015 at 7:42
Attachments:
Some processors do not have WTDO_4S and WDTO_8S implemented. See wdt.h
To support these devices the implementation of delay() should include some
conditional code. Proposal:
void NarcolepticClass::delay(uint32_t milliseconds)
{
#if defined WDP3
while (milliseconds >= 8000) { sleep(WDTO_8S); milliseconds -= 8000; }
if (milliseconds >= 4000) { sleep(WDTO_4S); milliseconds -= 4000; }
if (milliseconds >= 2000) { sleep(WDTO_2S); milliseconds -= 2000; }
#else
while (milliseconds >= 2000) { sleep(WDTO_2S); milliseconds -= 2000; }
#endif
if (milliseconds >= 1000) { sleep(WDTO_1S); milliseconds -= 1000; }
if (milliseconds >= 500) { sleep(WDTO_500MS); milliseconds -= 500; }
if (milliseconds >= 250) { sleep(WDTO_250MS); milliseconds -= 250; }
if (milliseconds >= 125) { sleep(WDTO_120MS); milliseconds -= 120; }
if (milliseconds >= 64) { sleep(WDTO_60MS); milliseconds -= 60; }
if (milliseconds >= 32) { sleep(WDTO_30MS); milliseconds -= 30; }
if (milliseconds >= 16) { sleep(WDTO_15MS); milliseconds -= 15; }
}
Original issue reported on code.google.com by [email protected]
on 16 Sep 2013 at 11:28
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.