Skip to content

Commit 89bcd1f

Browse files
committed
Adjust default main task size.
1 parent 95a0f81 commit 89bcd1f

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Scheduler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @file Scheduler.cpp
3-
* @version 1.4
3+
* @version 1.5
44
*
55
* @section License
66
* Copyright (C) 2015-2017, Mikael Patel
@@ -64,7 +64,7 @@ SchedulerClass::task_t SchedulerClass::s_main = {
6464
SchedulerClass::task_t* SchedulerClass::s_running = &SchedulerClass::s_main;
6565

6666
// Initial top stack for task allocation
67-
size_t SchedulerClass::s_top = SchedulerClass::DEFAULT_STACK_SIZE;
67+
size_t SchedulerClass::s_top = SchedulerClass::DEFAULT_MAIN_STACK_SIZE;
6868

6969
bool SchedulerClass::begin(size_t stackSize)
7070
{
@@ -126,8 +126,8 @@ void SchedulerClass::yield()
126126

127127
size_t SchedulerClass::stack()
128128
{
129-
size_t bytes = 0;
130129
const uint8_t* sp = s_running->stack;
130+
size_t bytes = 0;
131131
while (*sp++ == MAGIC) bytes++;
132132
return (bytes);
133133
}

Scheduler.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @file Scheduler.h
3-
* @version 1.5
3+
* @version 1.6
44
*
55
* @section License
66
* Copyright (C) 2015-2017, Mikael Patel
@@ -33,7 +33,7 @@ class SchedulerClass {
3333
/**
3434
* Initiate scheduler and main task with given stack size. Should
3535
* be called before start of any tasks if the main task requires a
36-
* stack size other than the default size. Returns true if
36+
* stack size other than the default main size. Returns true if
3737
* successful otherwise false.
3838
* @param[in] stackSize in bytes.
3939
* @return bool.
@@ -105,6 +105,7 @@ class SchedulerClass {
105105
#if defined(TEENSYDUINO)
106106
/** Default stack size and stack max. */
107107
static const size_t DEFAULT_STACK_SIZE = 1024;
108+
static const size_t DEFAULT_MAIN_STACK_SIZE = 2048;
108109
#if defined(__MK20DX256__)
109110
/** Teensy 3.2: 64 Kbyte. */
110111
static const size_t STACK_MAX = 16384;
@@ -121,15 +122,18 @@ class SchedulerClass {
121122
#elif defined(ARDUINO_ARCH_AVR)
122123
/** Default stack size. Stack max dynamically checked against heap end. */
123124
static const size_t DEFAULT_STACK_SIZE = 128;
125+
static const size_t DEFAULT_MAIN_STACK_SIZE = 256;
124126

125127
#elif defined(ARDUINO_ARCH_SAM)
126128
/** Default stack size and stack max. */
127129
static const size_t DEFAULT_STACK_SIZE = 1024;
130+
static const size_t DEFAULT_MAIN_STACK_SIZE = 2048;
128131
static const size_t STACK_MAX = 32768;
129132

130133
#elif defined(ARDUINO_ARCH_SAMD)
131134
/** Default stack size and stack max. */
132135
static const size_t DEFAULT_STACK_SIZE = 1024;
136+
static const size_t DEFAULT_MAIN_STACK_SIZE = 2048;
133137
static const size_t STACK_MAX = 16384;
134138

135139
#else

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=Portable Scheduler
2-
version=1.2.5
2+
version=1.2.6
33
author=Mikael Patel
44
maintainer=Mikael Patel <mikael.patel@gmail.com>
5-
sentence=Scheduler for simple multi-tasking.
6-
paragraph=This library is an implementation of an extended sub-set of Arduino Scheduler interface. The function yield() will context switch between multiple loop() functions.
5+
sentence=Scheduler for collaborative multi-tasking.
6+
paragraph=This library is a portable implementation of the Arduino Scheduler interface. The function yield() will context switch between multiple loop() functions.
77
category=Other
88
url=https://github.com/mikaelpatel/Arduino-Scheduler
99
architectures=avr,sam,samd

0 commit comments

Comments
 (0)