From e0c0faf646b790bf613dce34a6204ca9f3cbb495 Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Tue, 14 Mar 2017 09:48:23 +0100 Subject: [PATCH] add localization --- README.md | 6 ++++++ config_en.json | 11 +++++++++++ source/CalliopeDemo.cpp | 2 +- source/CalliopeDemo.h | 21 +++++++++++---------- 4 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 config_en.json diff --git a/README.md b/README.md index da1a3a3..29dae35 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ Calliope mini Demo. This repository contains the demo code and the board test code. The board test is only shown after initially flashing the device. Any subsequent reset or power cycle will not show it again. +## Compiling + +- `yt build` (add `--config config_en.json` to compile with English localization, default is German) +- copy the `calliope-demo-combined.hex` on the board + + ## Test Code After flashing this code, the test program will be executed once. Pressing `RESET` will directly go diff --git a/config_en.json b/config_en.json new file mode 100644 index 0000000..0476fc3 --- /dev/null +++ b/config_en.json @@ -0,0 +1,11 @@ +{ + "microbit-dal":{ + "bluetooth": { + "enabled": 0 + }, + "debug": 0 + }, + "use": { + "english": 1 + } +} \ No newline at end of file diff --git a/source/CalliopeDemo.cpp b/source/CalliopeDemo.cpp index 0ac1b38..f7fb3ca 100644 --- a/source/CalliopeDemo.cpp +++ b/source/CalliopeDemo.cpp @@ -70,7 +70,7 @@ const uint8_t arrow_right[25] = {0, 0, 1, 0, 0, }; const uint8_t arrow_leftright[25] = {0, 0, 1, 0, 0, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, + 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0 }; diff --git a/source/CalliopeDemo.h b/source/CalliopeDemo.h index 6dd377a..d696e20 100644 --- a/source/CalliopeDemo.h +++ b/source/CalliopeDemo.h @@ -1,8 +1,6 @@ #ifndef CALLOPE_DEMO_H #define CALLOPE_DEMO_H -//#define COMPILE_FIRMWARE_MASTER 0 -//#define USE_ENGLISH // MENU HANDLING typedef volatile enum State { @@ -22,22 +20,25 @@ extern const MicroBitImage Tick; void testBoard(); void snake(); +#ifdef YOTTA_CFG_COMPILE_MASTER +#define COMPILE_FIRMWARE_MASTER 0 +#endif // localization -#ifndef USE_ENGLISH -#define DISPLAY_HELLO "Hallo!" -#define DISPLAY_SHAKE "SCHUETTELN" -#define DISPLAY_ORACLE "Orakel" -#define DISPLAY_SUPER "SUPER!" -#define DISPLAY_THEEND "ENDE" -#define DISPLAY_ERROR "Huch?" -#else +#ifdef YOTTA_CFG_USE_ENGLISH #define DISPLAY_HELLO "Hello!" #define DISPLAY_SHAKE "SHAKE" #define DISPLAY_ORACLE "Oracle" #define DISPLAY_SUPER "SUPER!" #define DISPLAY_THEEND "THE END" #define DISPLAY_ERROR "Oops?" +#else +#define DISPLAY_HELLO "Hallo!" +#define DISPLAY_SHAKE "SCHUETTELN" +#define DISPLAY_ORACLE "Orakel" +#define DISPLAY_SUPER "SUPER!" +#define DISPLAY_THEEND "ENDE" +#define DISPLAY_ERROR "Huch?" #endif #endif