Skip to content

Commit d297b49

Browse files
authored
Merge pull request #230 from microbit-foundation/220-when-microbit-is-automatically-reconnected-it-shows-the-pattern-instead-of-the-happy-smiley
V2 microbit now shows correct display when reconnecting
2 parents e7c481e + 14506bc commit d297b49

File tree

5 files changed

+15191
-14988
lines changed

5 files changed

+15191
-14988
lines changed

microbit/v2/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ buildcache.json
1616
*.pyc
1717

1818
build_and_move.sh
19-
build_clear_and_move.sh
19+
build_clear_and_move.sh
20+
21+
samples/

microbit/v2/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,24 @@ You need some open source pre-requisites to build this repo. You can either inst
1414
- [Github desktop](https://desktop.github.com/)
1515
- [CMake](https://cmake.org/download/)
1616
- [Python 3](https://www.python.org/downloads/)
17+
- For OS X you may need command line tools for xcode. Install using `xcode-select --install`
1718

1819
**OR**
1920

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

2223
# Building without docker
2324
- Clone this repository
24-
- In the root of this repository type `python3 build.py` or `python build.py` depending on python version
25-
- The hex file will be built `MICROBIT.HEX` and placed in the root folder.
25+
- In the folder `/microbit/v2` type `execute python3 build.py` or `python build.py` depending on python version
26+
- The hex file will be built `MICROBIT.HEX` and placed in the `/microbit/v2` folder.
2627
- 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.
2728

29+
**Note**: for OS X users receiving the error
30+
31+
```xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun```
32+
33+
install xcode command line tools using `xcode-select --install`
34+
2835
### Broken .hex fix
2936
If at some point the HEX file doesn't seem to work, but compiles fine, check `codal.json` to see if the following is missing.
3037

microbit/v2/source/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ int main()
9191
printSmiley(GLAD_SMILEY);
9292

9393
uBit.sleep(400);
94-
printPairPatternAnimated();
95-
94+
if (!connected) {
95+
printPairPatternAnimated();
96+
}
97+
if (connected) {
98+
printSmiley(GLAD_SMILEY);
99+
}
96100
release_fiber();
97101
}

0 commit comments

Comments
 (0)