Skip to content

Commit

Permalink
Merge pull request #313 from microbit-foundation/main
Browse files Browse the repository at this point in the history
Minor update: Code cleaning and bug fixes
  • Loading branch information
Karlo-Emilo authored Aug 24, 2023
2 parents 5bdeb70 + 0fafd9e commit 3488144
Show file tree
Hide file tree
Showing 161 changed files with 19,977 additions and 72,060 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@

.vscode/

.env
!.vscode/settings.json

.env
7 changes: 6 additions & 1 deletion .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
module.exports = {
arrowParens: 'avoid',
singleQuote: true,
Expand All @@ -6,7 +11,7 @@ module.exports = {
semi: true,
svelteSortOrder: 'options-styles-scripts-markup',
svelteStrictMode: false,
svelteBracketNewLine: false,
bracketSameLine: true,
svelteAllowShorthand: true,
svelteIndentScriptAndStyle: true,
trailingComma: 'all',
Expand Down
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"svelte.plugin.svelte.compilerWarnings": {
"a11y-aria-attributes": "ignore",
"a11y-incorrect-aria-attribute-type": "ignore",
"a11y-unknown-aria-attribute": "ignore",
"a11y-hidden": "ignore",
"a11y-misplaced-role": "ignore",
"a11y-unknown-role": "ignore",
"a11y-no-abstract-role": "ignore",
"a11y-no-redundant-roles": "ignore",
"a11y-role-has-required-aria-props": "ignore",
"a11y-accesskey": "ignore",
"a11y-autofocus": "ignore",
"a11y-misplaced-scope": "ignore",
"a11y-positive-tabindex": "ignore",
"a11y-invalid-attribute": "ignore",
"a11y-missing-attribute": "ignore",
"a11y-img-redundant-alt": "ignore",
"a11y-label-has-associated-control": "ignore",
"a11y-media-has-caption": "ignore",
"a11y-distracting-elements": "ignore",
"a11y-structure": "ignore",
"a11y-click-events-have-key-events": "ignore",
"a11y-missing-content": "ignore"
}
}
141 changes: 141 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Change log

Notable changes to the project will be archieved here


## [1.8.1](https://gitlab.au.dk/au-cs-ceed/ml-microbit-browser/-/releases/v1.8.1) - 11/01 - 2023
Fixes some problems after reaching feature parity between DR and master release branches

### Changed
- Removes ID field from menu properties
- Moved management of menus out of svelte components

### Fixed
- Fixed type errors and warnings for graph components
- Cookie banner can now select language
- Fixed a bug with predictions causing NaN confidence

## [1.8.0](https://gitlab.au.dk/au-cs-ceed/ml-microbit-browser/-/releases/v1.8.0) - 22/12 - 2022
Jest has been introduced! And with it comes the promise of stability. In addition, some graphical and translation issues has been addressed.

### Added
- Jest has been introduced (see `src/__tests__/` for examples on how they work)
- Tests for finding unused translations
- Tests for inconsistencies in the translations, such as having to include both an english and danish translation of a phrase.
- Both english and danish translations must be of equal length

### Fixed
- Thanks to jest we have found several issues with the translation, which has been addressed, including removing unused/redundant translations
- The highlights on the pattern matrix now disappears when moving outside the drawing area.

## [1.7.0](https://gitlab.au.dk/au-cs-ceed/ml-microbit-browser/-/releases/v1.2.0) - 1/12 - 2022
Jest has been introduced! And with it comes the promise of stability. In addition, some graphical and translation issues has been addressed.

### Added
- Jest has been introduced (see `src/__tests__/` for examples on how they work)
- Tests for finding unused translations
- Tests for inconsistencies in the translations, such as having to include both an english and danish translation of a phrase.
- Both english and danish translations must be of equal length

### Fixed
- Thanks to jest we have found several issues with the translation, which has been addressed, including removing unused/redundant translations
- The highlights on the pattern matrix now disappears when moving outside the drawing area.

## [1.6.0](https://gitlab.au.dk/au-cs-ceed/ml-microbit-browser/-/releases/v1.1.0) - 22/11 - 2022
Introduces a new pairing pattern system
### Added
- Pairing pattern now automatically fills out squares beneath the targeted square. In addition it outlines any squares below the one that is currently being hovered over.
- The ConnectionBehaviour callback promptOpen is now fired when the connection prompt opens.

### Fixed
- The information icon is now fixed in place on recorded gestures. Before it would move when scrolling the page
- Spinning icon no longer escapes the menu box after a model has been trained.
- Information icons no longer have higher z-index priority over the control-bar
- Failed connectivity errors that would occur when the micro:bit was successfully connected but loses connection before adding the listener to the services such as accelerometer are now caught and display a 'connection failed' message.
- Added some missing translations for prompts when deleting tests/gestsures
- Reduced the overflow issue that would cause the left hand side menu to overflow when testcenter was open on chromebooks. It is still an issue, but now the home button is accessible.
- Swapped the outline on the bottom input graph for a border, since it caused some graphical issues due to it being placed outside the container.

## [1.5.0](https://gitlab.au.dk/au-cs-ceed/ml-microbit-browser/-/releases/v1.0.1) - 17/11 - 2022
Welcome Jon, who has joined the project.

This version was created to improve stability and transitioning the micro:bit firmware from MakeCode to C++. The C++ firmware can be found as a repository under the AU CS CEED group.
### Added
- Added Dialog box component for contact information

### Changed
- Removed top bar from DataPage
- Many styling changes to support the upcoming DR-release

### Fixed
- Flashing error handling. Now gives appropriate feedback
- Alignment issues
- Issues only present on chromebook
- Fixed a null pointer exception that was thrown when resizing the overlay on the output page.
- Closed issue where the pairing pattern would sometimes be wrong on the micro:bit. Issue could not be replicated after new HEX file.
- Fixed text alignment issue on the left hand side menus. Text was not align vertically to the center when collapsed.
- Improved solution for handling failed flashes / get friendly name. Now these should be caught with the promise.catch(e) statement.
- Fixed some connectivity issues on the micro:bit. This was caused by using too little power for the transmission component of the BLE.



## [1.4.0] - 6/10 - 2022
This release signifies the last release before the DR-cooperation project starts
### Added
- Added compatibility checking for USB and bluetooth
- Added connect with USB step
- Added skeletal animations

### Changed
- Now allows for multi-line information boxes

### Fixed
- Fixed the model-page no-output overlay issue



## [1.3.0] - 6/10 - 2022

### Added
- Cookie banner and cookie manager
- Introduced a standardized button
- Added Generic Modal
- MicrobitUSB now has an event-emitting implementation
- MicrobitBluetooth can now emit events


### Changed
- Reduced the usage of z-layer or reduced their values, keeping them from going wild
- Completely overhauled the code structure, using less position: absolute

### Fixed
- One can no longer close while transferral is in progress


## [1.2.0] - 1/09 - 2022

### Added
- Added pairing pattern connection
- Added new connection flow
- Added flashing .hex files through USB
- MBSpecs, a microbit specification file for details such as UUIDs for bluetooth services

### Changed
- Added interfaces that controls input/output seperately through implementation
- Many files converted to TypeScript

### Fixed
- Fixed a bug, that caused failed data loading from localStorage

## [1.1.0] - 30/06 - 2022

### Added
- Added support for v1 microbits
- Bluetooth wrapper for interacting with microbits

### Changed
- Magic values replaced by configuration settings

## [1.0.0] - 15/09 - 2021

Initial release of ML-Machine.
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<!--
(c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
SPDX-License-Identifier: MIT
-->
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down
5 changes: 5 additions & 0 deletions microbit/v1/source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
#include "MicroBit.h"
#include "MicroBitUARTService.h"
#include "MicroBitAccelerometerService.h"
Expand Down
14 changes: 10 additions & 4 deletions microbit/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ That repository is a good starting place if one wishes to learn more about devel
You need some open source pre-requisites to build this repo. You can either install these tools yourself, or use the docker image provided below.

- [GNU Arm Embedded Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
- [Github desktop](https://desktop.github.com/)
- [Git](https://git-scm.com/)
- [CMake](https://cmake.org/download/)
- [Python 3](https://www.python.org/downloads/)
- For OS X you may need command line tools for xcode. Install using `xcode-select --install`
- For linux you may need the package
- `arm-none-eabi-newlib` - Found to be the case in Arch Linux.

**OR**

One can use docker instead of downloading these dependencies (read about this here [here](https://github.com/lancaster-university/microbit-v2-samples))

# Building without docker
- Clone this repository
- In the folder `/microbit/v2` type `execute python3 build.py` or `python build.py` depending on python version
- In the folder `/microbit/v2` type `python3 build.py` or `python build.py` depending on python version
- The hex file will be built `MICROBIT.HEX` and placed in the `/microbit/v2` folder.
- If at some point any config changes are made outside any .cpp files run `python3 build.py -c`. The `-c` flag will clear the build files. If this is not done the changes to config will not take effect.

Expand Down Expand Up @@ -177,8 +179,12 @@ void onDelim(MicroBitEvent)
{
int beat = 200;
ManagedString r = uart->readUntil("#");
ManagedString soundNo = r.substring(1,1);
playSound(getSound(soundNo), beat);
ManagedString prefix = r.substring(0,2);
if (prefix == "s_") {
ManagedString soundNo = r.substring(2,1);
playSound(getSound(soundNo), beat);
}
}
```
`onDelim` is the event called by the micro:bit event system when a *delimiting character* was received. Right now the UART service is used to determine what sound should be played. It will read from the buffer until the delimiting character, in this case '#', and since sound indeces from ML-Machine.org are sent as s1, s2 etc, it will substring the last character giving s1->1 s2->2, which will be used to figure out what sound to play.
Expand Down
6 changes: 6 additions & 0 deletions microbit/v2/source/codebook.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/

#include "MicroBit.h"
#ifndef CODEBOOK_H_INCLUDED
#define CODEBOOK_H_INCLUDED
Expand Down
6 changes: 6 additions & 0 deletions microbit/v2/source/helpers.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/

#include "MicroBit.h"
#include "codebook.h"
#include "utilities.h"
Expand Down
12 changes: 10 additions & 2 deletions microbit/v2/source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
#include "MicroBit.h"
#include "MicroBitUARTService.h"
#include "MicroBitAccelerometerService.h"
Expand Down Expand Up @@ -63,8 +68,11 @@ void onDelim(MicroBitEvent)
{
int beat = 200;
ManagedString r = uart->readUntil("#");
ManagedString soundNo = r.substring(1,1);
playSound(getSound(soundNo), beat);
ManagedString prefix = r.substring(0,2);
if (prefix == "s_") { // Will be request to play sound
ManagedString soundNo = r.substring(2,1);
playSound(getSound(soundNo), beat);
}
}

int main()
Expand Down
5 changes: 5 additions & 0 deletions microbit/v2/source/smileys.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
#include "utilities.h"
#ifndef SMILEYS_H_INCLUDED
#define SMILEYS_H_INCLUDED
Expand Down
5 changes: 5 additions & 0 deletions microbit/v2/source/sound.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
#include "MicroBit.h"
#include "utilities.h"
#include "sounds.h"
Expand Down
5 changes: 5 additions & 0 deletions microbit/v2/source/sounds.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
#include "utilities.h"
#ifndef SOUNDS_H_INCLUDED
#define SOUNDS_H_INCLUDED
Expand Down
5 changes: 5 additions & 0 deletions microbit/v2/source/utilities.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
*
* SPDX-License-Identifier: MIT
*/
#ifndef UTILITIES_H_INCLUDED
#define UTILITIES_H_INCLUDED

Expand Down
Loading

0 comments on commit 3488144

Please sign in to comment.