Commit Graph

750 Commits

Author SHA1 Message Date
Joe Finney 3bccdd6c8e Ensure consistent behaviour of MicroBitDisplay::print() operations
- Simplify behaviour of print() and printAsync() methods.
  - print(char) print(ManagedString) and print(MicroBitImage) now all have same semantics:

    - If provided, the delay parameter is always respected. Screen is cleared after that time.

    - discrete print operations (character, string of length 1 and MicroBitImage) with no
      delay parameter are printed, and return immeditely. The screen is not cleared.

    - print (string of length > 1) with no delay parameter defaults to a delay
      of MICROBIT_DEFAULT_PRINT_SPEED milliseconds. The screen is cleared on
      completion.
2020-04-21 19:03:31 +01:00
Joe Finney 0fd4a8018c Correctly initialise animation timer for printChar() Fix #463 2020-04-21 16:35:27 +01:00
Joe Finney dd339a7f4c Honour delay parameter in MicroBitDisplay::print(MicroBitImage)
- Fix bug https://github.com/microsoft/pxt-microbit/issues/2739
2020-04-01 16:58:07 +01:00
Joe Finney f96a390366 Use schedule() not fiber_sleep(0) in MicroBitSerial.cpp (Fix #461)
- MicroBitSerial use wake_on_event for condition synchronisation.
  - By contract, a fiber doing this should subsequently call schedule()
    and no other blocking operation
2020-04-01 14:54:51 +01:00
Joe Finney 76538ef6cb Re-enumerate component ID values to align with CODAL
- Update component ID values to align with those used in CODAL
  - Just enables some code cleanup within MakeCode.
2020-03-25 17:06:50 +00:00
Joe Finney 3ed3674fe1 Add CONFIG flag to indicate use of get_fiber_list() API 2020-03-25 16:45:36 +00:00
Joe Finney 219feb8511 Remove list_fibers API
- Remove redundant API
  - superceded by get_fiber_list()
2020-03-25 16:28:20 +00:00
Joe Finney c42776ced5 Merge branch 'pxtgc' into js-event-semantics 2020-03-25 16:03:45 +00:00
Joe Finney d823d4b4a6 Rename list pointers in MicroBitFiber.h
- Rename pointers in Fiber struct to be more intuitive.
2020-03-25 15:36:27 +00:00
Michal Moskal 15ebed2ad5 Add fiber_user_data to yotta mappings; fix some errors 2020-03-24 15:26:40 +00:00
Michal Moskal 415e5ebed2 Compilation fixes 2020-03-24 15:26:40 +00:00
Michal Moskal 92d0ceebc7 Allow overriding of the heap allocator and getting heap sizes
Also port from codal-core in support of PXT GC.
Also, fix compiler optimization bug in calloc().
2020-03-24 15:26:39 +00:00
Michal Moskal 25e1e10d63 Add Fiber->user_data and list_fiber()
This is port of relevant codal changes in support of GC in the
PXT runtime.
Also, limit the number of fibers in pool to 3.
2020-03-24 15:26:39 +00:00
Joe Finney 8075eab349 .gitignore vscode metadata 2020-03-24 15:21:28 +00:00
James Devine 602153e919
Merge pull request #452 from nealmcb/patch-1
Clarify what dal stands for
2019-10-01 10:36:08 +01:00
Neal McBurnett b07a17ad92
Clarify what dal stands for 2019-09-30 11:43:02 -06:00
Joe Finney c04b1fd36e Merge branch 'js-event-semantics' of https://www.github.com/lancaster-university/microbit-dal into js-event-semantics 2019-05-08 11:50:53 +01:00
Joe Finney 77d679c87f Ensure MicroBitDisplay::waitForFreeDisplay() is free of race conditions
Update to the internal  MicroBitDisplay::waitForFreeDisplay() method to ensure
that fibers queued waiting for access to the display always re-contest for
access, thereby avoiding potnetial race conditions.
2019-05-08 11:48:48 +01:00
Joe Finney b28dba41df MicroBitMessageBus::process() updated to pass events by value
Updated parameters of this internal method to pass the event being processed
by value, rather than by reference. This is important for applications using
the MESSAGE_BUS_CONCURRENT_EVENTS concurrency mode (JavaScript semantics) to
ensure that any multiple event handlers registered for the same event maintain
a persistent copy of that event on the relevant fiber stack.
2019-05-08 11:48:48 +01:00
Joe Finney c9c98beffe Update string print() method to avoid unecessary delays
- First character of string is now printed on next frame update, rather than
   waiting for an inter-character gap

 - No unecessary delay after the final character is printed.

These changes make the print() semantics align with the image animate()
semantics.
2019-05-08 11:46:07 +01:00
Joe Finney 741335200d Introduce optional javascript semantics for event handling
- new CONFIG option now allows the user to choose between ordered, serial
    processing of event handlers and parallel execution of events (JS
semantics) OR parallel processing of event handlers and serial execution of
events (legacy mciro:bit semantics)

  - Introduciton of a MicroBitLock primitive for mutual exclusion
2019-05-08 11:46:07 +01:00
Joe Finney 92c6cc64b4 Allow overriding of the heap allocator and getting heap sizes
Also port from codal-core in support of PXT GC.
Also, fix compiler optimization bug in calloc().
2019-05-08 11:19:10 +01:00
Joe Finney 226bf9cead Replace FiberTable with a list of all fibers to save memory
- Remove FiberTable structure
  - Remove CONFIG options and mappings relating to table size
  - Add new list linkage to Fiber structure to maintain list of all Fibers
  - Replace get_fiber_table() with get_fiber_list()
2019-05-08 10:53:46 +01:00
Joe Finney b9816a49ec Reintroduce validation test in fiber_sleep()
- Replace accidentally deleted validation check in fiber_sleep().
2019-05-07 17:22:08 +01:00
Joe Finney b71334ee4e Add user define limit to size of FiberPool 2019-05-07 16:58:27 +01:00
Joe Finney 07f07fba17 Ensure Fiber stack allocation happens in the context of that Fiber 2019-05-07 15:38:02 +01:00
Joe Finney 461fb33b0f Integrate optional fiber meta-data contributed in #424
- Add new CONFIG option to enable per-fiber meta data (default: disabled)
  - Add (void *) pointer to Fiber struct when CONFIG option enabled
  - Add Yotta CONFIG glue
  - Refactor fork-on-block handling into a unified function
  - Align validation semantics of both flavours of invoke() function
2019-05-07 15:29:23 +01:00
Joe Finney 1c1426ffe4 Introduce FiberTable stucture
- Create a new FiberTable structure, that record all active fibers
  - Update fiber creation/deletion code to maintain the table
  - Add a utility function to allow read access to the table
  - Introduce a CONFIG option to define the initial FiberTable size
2019-05-03 18:52:06 +01:00
Joe Finney 60d423ec36 Ignore .vscode metadata 2019-05-03 17:08:13 +01:00
Joe Finney 31fea820d6 Change Fiber lists to be singly-linked
- Replace doubly linked list of Fibers with singly-linked equivalent to
    reduce memory footprint.
2019-05-03 17:06:33 +01:00
Joe Finney ca43746e20 Ensure MicroBitDisplay::waitForFreeDisplay() is free of race conditions
Update to the internal  MicroBitDisplay::waitForFreeDisplay() method to ensure
that fibers queued waiting for access to the display always re-contest for
access, thereby avoiding potnetial race conditions.
2019-02-27 22:04:51 +00:00
Joe Finney 6112d7472c MicroBitMessageBus::process() updated to pass events by value
Updated parameters of this internal method to pass the event being processed
by value, rather than by reference. This is important for applications using
the MESSAGE_BUS_CONCURRENT_EVENTS concurrency mode (JavaScript semantics) to
ensure that any multiple event handlers registered for the same event maintain
a persistent copy of that event on the relevant fiber stack.
2019-02-27 21:59:41 +00:00
Joe Finney b1cb51901f Simplify implementation of fiber_wake_on_event()
Align fork-on-block implementation of fiber_wake_on_event() with that of fiber_sleep() and MicroBitLock::wait().

This patch has no impact on external behaviour, but introduces a consistent
deisgn pattern for fork-on-block handling within the scheduler.
2019-02-27 21:53:43 +00:00
Joe Finney 69bf72e8b5 Update string print() method to avoid unecessary delays
- First character of string is now printed on next frame update, rather than
   waiting for an inter-character gap

 - No unecessary delay after the final character is printed.

These changes make the print() semantics align with the image animate()
semantics.
2019-02-27 19:39:25 +00:00
Sam Kent 8c2403e964
Merge pull request #410 from microbit-sam/changelog-2.1.1
Update CHANGELOG for v2.1.1
2018-12-19 15:25:36 +00:00
Sam Kent 484c15f878 Update CHANGELOG 2018-11-28 14:10:00 +00:00
Joe Finney 51011d32e3 Bump to v2.1.1 2018-11-23 14:13:37 +00:00
Joe Finney 1003cdefbf
Merge pull request #408 from microbit-sam/remove-int-io
Remove Int1,2,3
2018-11-23 13:58:19 +00:00
Sam Kent 521381d276 Remove int1,2,3 2018-11-22 14:00:07 +00:00
Joe Finney 3b3848a4c3
Merge pull request #401 from microbit-sam/050
Delay microbit_panic for 050 / 051 errors
2018-11-08 09:44:59 +00:00
Sam Kent 96126fd23f Delay microbit_panic 2018-10-24 20:55:19 +01:00
Joe Finney 11c8205754
Merge pull request #391 from lancaster-university/print-heap
Make microbit_heap_print() available externally
2018-10-02 17:21:48 +01:00
Jonathan Austin 3e37cc9c4e Make microbit_heap_print() available externally
The heap printing in MicrobitHeapAllocator is really useful for
gauging how much memory is free at various points in the program.

Specifically, by calling this after the uBit object is created we
can start to measure a high-water-mark for RAM and track it over
releases, etc
2018-10-02 17:14:05 +01:00
Joe Finney 94fa768a8f
Merge pull request #389 from microbit-sam/radio-patch
Radio Patch: Correctly set TX Power, Update Frequency Limit
2018-09-28 16:14:00 +01:00
Joe Finney 9dedea4df2 Introduce optional javascript semantics for event handling
- new CONFIG option now allows the user to choose between ordered, serial
    processing of event handlers and parallel execution of events (JS
semantics) OR parallel processing of event handlers and serial execution of
events (legacy mciro:bit semantics)

  - Introduciton of a MicroBitLock primitive for mutual exclusion
2018-09-27 17:51:17 +01:00
Sam Kent 01d6d4f39a Added Yotta Glue 2018-09-27 12:12:01 +01:00
Sam Kent 7aedfab59a Add defines for radio upper/lower freq 2018-09-24 18:26:48 +01:00
Sam Kent 54a99d6361 Use setTransmitPower() 2018-09-24 17:06:30 +01:00
Joe Finney 3898c0ddc7 Fix CHANGELOG layout 2018-09-19 20:09:14 -07:00
Joe Finney fffda0b1e8 Add CHANGLEOG and update for v2.1.0 2018-09-19 20:06:33 -07:00