Skip to content

Commit

Permalink
[Update] Epsilon 15.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RedGl0w committed Jan 21, 2021
2 parents f202a4f + 11ef4bd commit 9b17d1b
Show file tree
Hide file tree
Showing 700 changed files with 15,113 additions and 7,292 deletions.
64 changes: 62 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
name: Continuous integration
on: [pull_request, push]
#on: [pull_request, push]
on:
pull_request:
workflow_dispatch:
inputs:
triggerIos:
description: 'Run iOS tests'
required: true
default: 'no'
triggerMacos:
description: 'Run macOS tests'
required: true
default: 'no'

jobs:
# nintendo_3ds:
Expand All @@ -11,7 +23,7 @@ jobs:
# - run: echo ::set-env name=DEVKITPRO::/opt/devkitpro
# - run: echo ::set-env name=DEVKITARM::/opt/devkitpro/devkitARM
# - run: echo ::set-env name=PATH::$DEVKITPRO/tools/bin:$DEVKITARM/bin:$PATH

# - uses: actions/checkout@v1
# with:
# submodules: true
Expand Down Expand Up @@ -94,6 +106,23 @@ jobs:
with:
name: epsilon-binpack-n0110.tgz
path: output/release/device/n0110/binpack-n0110.tgz
windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
- uses: actions/checkout@v2
- run: pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-freetype mingw-w64-x86_64-pkg-config make mingw-w64-x86_64-python3 mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libpng
- run: make -j2 PLATFORM=simulator
- run: make -j2 PLATFORM=simulator epsilon.official.exe
- run: make -j2 PLATFORM=simulator test.headless.exe
- run: output/release/simulator/windows/test.headless.exe
- uses: actions/upload-artifact@master
with:
name: epsilon-windows.exe
path: output/release/simulator/windows/epsilon.exe
web:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -121,3 +150,34 @@ jobs:
name: epsilon-linux.bin
path: output/release/simulator/linux/epsilon.bin
- run: make -j2 PLATFORM=simulator test.headless.bin
macos:
if: github.event.inputs.triggerMacos == 'yes'
runs-on: macOS-latest
steps:
- run: brew install numworks/tap/epsilon-sdk
- uses: actions/checkout@v2
- run: make -j2 PLATFORM=simulator
- run: make -j2 PLATFORM=simulator epsilon.official.app
- run: make -j2 PLATFORM=simulator ARCH=x86_64 test.headless.bin
- run: output/release/simulator/macos/x86_64/test.headless.bin
- uses: actions/upload-artifact@master
with:
name: epsilon-macos.zip
path: output/release/simulator/macos/epsilon.app
ios:
if: github.event.inputs.triggerIos == 'yes'
runs-on: macOS-latest
steps:
- run: brew install numworks/tap/epsilon-sdk
- uses: actions/checkout@v2
- run: make -j2 PLATFORM=simulator TARGET=ios EPSILON_TELEMETRY=0
- run: make -j2 PLATFORM=simulator TARGET=ios EPSILON_TELEMETRY=0 epsilon.official.ipa
- run: make -j2 PLATFORM=simulator TARGET=ios EPSILON_TELEMETRY=0 test.ipa
- run: make -j2 PLATFORM=simulator TARGET=ios EPSILON_TELEMETRY=0 APPLE_PLATFORM=ios-simulator
- uses: actions/upload-artifact@master
with:
name: epsilon-ios.ipa
path: output/release/simulator/ios/epsilon.ipa

env:
ACCEPT_OFFICIAL_TOS: 1
14 changes: 10 additions & 4 deletions apps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ apps_src += $(addprefix apps/,\
title_bar_view.cpp \
)

tests_src += apps/exam_mode_configuration_non_official.cpp
tests_src += $(addprefix apps/,\
exam_mode_configuration_official.cpp \
)


snapshots_declaration = $(foreach i,$(apps),$(i)::Snapshot m_snapshot$(subst :,,$(i))Snapshot;)
apps_declaration = $(foreach i,$(apps),$(i) m_$(subst :,,$(i));)
Expand All @@ -56,6 +59,9 @@ $(call object_for,apps/apps_container_storage.cpp apps/apps_container.cpp apps/m

# I18n file generation

country_preferences = apps/country_preferences.csv
language_preferences = apps/language_preferences.csv

# The header is refered to as <apps/i18n.h> so make sure it's findable this way
SFLAGS += -I$(BUILD_DIR)

Expand All @@ -65,14 +71,14 @@ i18n_files += $(addprefix apps/language_,$(addsuffix _iso6391.universal.i18n, $(
endif

i18n_files += $(call i18n_with_universal_for,shared)
i18n_files += $(call i18n_without_universal_for,toolbox)
i18n_files += $(call i18n_with_universal_for,toolbox)
i18n_files += $(call i18n_without_universal_for,variables)

$(eval $(call rule_for, \
I18N, \
apps/i18n.cpp, \
$(i18n_files), \
$$(PYTHON) apps/i18n.py --codepoints $(code_points) --header $$(subst .cpp,.h,$$@) --implementation $$@ --locales $$(EPSILON_I18N) --files $$^ --generateISO6391locales $$(EPSILON_GETOPT), \
$$(PYTHON) apps/i18n.py --codepoints $(code_points) --countrypreferences $(country_preferences) --languagepreferences $(language_preferences) --header $$(subst .cpp,.h,$$@) --implementation $$@ --locales $$(EPSILON_I18N) --countries $$(EPSILON_COUNTRIES) --files $$^ --generateISO6391locales $$(EPSILON_GETOPT), \
global \
))

Expand All @@ -87,7 +93,7 @@ $(eval $(call depends_on_image,apps/title_bar_view.cpp,apps/exam_icon.png))
$(call object_for,$(apps_src) $(tests_src)): $(BUILD_DIR)/apps/i18n.h
$(call object_for,$(apps_src) $(tests_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h

apps_tests_src = $(app_calculation_test_src) $(app_code_test_src) $(app_probability_test_src) $(app_regression_test_src) $(app_sequence_test_src) $(app_shared_test_src) $(app_statistics_test_src) $(app_settings_test_src) $(app_solver_test_src)
apps_tests_src = $(app_calculation_test_src) $(app_code_test_src) $(app_graph_test_src) $(app_probability_test_src) $(app_regression_test_src) $(app_sequence_test_src) $(app_shared_test_src) $(app_statistics_test_src) $(app_settings_test_src) $(app_solver_test_src)

apps_tests_src += $(addprefix apps/,\
alternate_empty_nested_menu_controller.cpp \
Expand Down
27 changes: 21 additions & 6 deletions apps/apps_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,23 @@ AppsContainer::AppsContainer() :
}

bool AppsContainer::poincareCircuitBreaker() {
constexpr uint64_t minimalPressDuration = 20;
static uint64_t beginningOfInterruption = 0;
Ion::Keyboard::State state = Ion::Keyboard::scan();
return state.keyDown(Ion::Keyboard::Key::Back);
bool interrupt = state.keyDown(Ion::Keyboard::Key::Back) || state.keyDown(Ion::Keyboard::Key::Home) || state.keyDown(Ion::Keyboard::Key::OnOff);
if (!interrupt) {
beginningOfInterruption = 0;
return false;
}
if (beginningOfInterruption == 0) {
beginningOfInterruption = Ion::Timing::millis();
return false;
}
if (Ion::Timing::millis() - beginningOfInterruption > minimalPressDuration) {
beginningOfInterruption = 0;
return true;
}
return false;
}

App::Snapshot * AppsContainer::hardwareTestAppSnapshot() {
Expand Down Expand Up @@ -181,7 +196,7 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
}
if (changedZoom) {
KDIonContext::sharedContext()->updatePostProcessingEffects();
redrawWindow(true);
redrawWindow();
return true;
}
}
Expand Down Expand Up @@ -341,7 +356,7 @@ void AppsContainer::shutdownDueToLowBattery() {
* case. */
return;
}
while (Ion::Battery::level() == Ion::Battery::Charge::EMPTY) {
while (Ion::Battery::level() == Ion::Battery::Charge::EMPTY && !Ion::USB::isPlugged()) {
Ion::Backlight::setBrightness(0);
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
/* Unless the LED is lit up for the exam mode, switch off the LED. IF the
Expand All @@ -365,15 +380,15 @@ bool AppsContainer::updateAlphaLock() {
return m_window.updateAlphaLock();
}

OnBoarding::PopUpController * AppsContainer::promptController() {
OnBoarding::PromptController * AppsContainer::promptController() {
if (k_promptNumberOfMessages == 0) {
return nullptr;
}
return &m_promptController;
}

void AppsContainer::redrawWindow(bool force) {
m_window.redraw(force);
void AppsContainer::redrawWindow() {
m_window.redraw();
}

void AppsContainer::activateExamMode(GlobalPreferences::ExamMode examMode) {
Expand Down
8 changes: 4 additions & 4 deletions apps/apps_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "global_preferences.h"
#include "backlight_dimming_timer.h"
#include "shared/global_context.h"
#include "on_boarding/pop_up_controller.h"
#include "clock_timer.h"
#include "on_boarding/prompt_controller.h"

#include <ion/events.h>

Expand Down Expand Up @@ -47,8 +47,8 @@ class AppsContainer : public Container, ExamPopUpControllerDelegate, Ion::Storag
void displayExamModePopUp(GlobalPreferences::ExamMode mode);
void shutdownDueToLowBattery();
void setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus);
OnBoarding::PopUpController * promptController();
void redrawWindow(bool force = false);
OnBoarding::PromptController * promptController();
void redrawWindow();
void activateExamMode(GlobalPreferences::ExamMode examMode);
// Exam pop-up controller delegate
void examDeactivatingPopUpIsDismissed() override;
Expand All @@ -74,7 +74,7 @@ class AppsContainer : public Container, ExamPopUpControllerDelegate, Ion::Storag
MathToolbox m_mathToolbox;
MathVariableBoxController m_variableBoxController;
ExamPopUpController m_examPopUpController;
OnBoarding::PopUpController m_promptController;
OnBoarding::PromptController m_promptController;
BatteryTimer m_batteryTimer;
SuspendTimer m_suspendTimer;
BacklightDimmingTimer m_backlightDimmingTimer;
Expand Down
2 changes: 1 addition & 1 deletion apps/battery_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BatteryTimer::BatteryTimer() :
bool BatteryTimer::fire() {
AppsContainer * container = AppsContainer::sharedAppsContainer();
bool needRedrawing = container->updateBatteryState();
if (Ion::Battery::level() == Ion::Battery::Charge::EMPTY) {
if (Ion::Battery::level() == Ion::Battery::Charge::EMPTY && !Ion::USB::isPlugged()) {
container->shutdownDueToLowBattery();
}
return needRedrawing;
Expand Down
1 change: 1 addition & 0 deletions apps/calculation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ app_calculation_src = $(addprefix apps/calculation/,\
additional_outputs/integer_list_controller.cpp \
additional_outputs/scrollable_three_expressions_cell.cpp \
additional_outputs/list_controller.cpp \
additional_outputs/matrix_list_controller.cpp \
additional_outputs/rational_list_controller.cpp \
additional_outputs/trigonometry_graph_cell.cpp \
additional_outputs/trigonometry_list_controller.cpp \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ExpressionsListController::ExpressionsListController(EditExpressionController *
ListController(editExpressionController),
m_cells{}
{
for (int i = 0; i < k_maxNumberOfCells; i++) {
for (int i = 0; i < k_maxNumberOfRows; i++) {
m_cells[i].setParentResponder(m_listController.selectableTableView());
}
}
Expand All @@ -21,15 +21,20 @@ void ExpressionsListController::didEnterResponderChain(Responder * previousFirst
}

int ExpressionsListController::reusableCellCount(int type) {
return k_maxNumberOfCells;
return k_maxNumberOfRows;
}

void ExpressionsListController::viewDidDisappear() {
ListController::viewDidDisappear();
// Reset cell memoization to avoid taking extra space in the pool
for (int i = 0; i < k_maxNumberOfCells; i++) {
// Reset layout and cell memoization to avoid taking extra space in the pool
for (int i = 0; i < k_maxNumberOfRows; i++) {
m_cells[i].setLayout(Layout());
/* By reseting m_layouts, numberOfRow will go down to 0, and the highlighted
* cells won't be unselected. Therefore we unselect them here. */
m_cells[i].setHighlighted(false);
m_layouts[i] = Layout();
}
m_expression = Expression();
}

HighlightCell * ExpressionsListController::reusableCell(int index, int type) {
Expand All @@ -43,24 +48,34 @@ KDCoordinate ExpressionsListController::rowHeight(int j) {
}

void ExpressionsListController::willDisplayCellForIndex(HighlightCell * cell, int index) {
/* Note : To further optimize memoization space in the pool, layout
* serialization could be memoized instead, and layout would be recomputed
* here, when setting cell's layout. */
ExpressionTableCellWithPointer * myCell = static_cast<ExpressionTableCellWithPointer *>(cell);
myCell->setLayout(layoutAtIndex(index));
myCell->setAccessoryMessage(messageAtIndex(index));
myCell->reloadScroll();
}

int ExpressionsListController::numberOfRows() const {
int nbOfRows = 0;
for (size_t i = 0; i < k_maxNumberOfRows; i++) {
if (!m_layouts[i].isUninitialized()) {
nbOfRows++;
}
}
return nbOfRows;
}

void ExpressionsListController::setExpression(Poincare::Expression e) {
// Reinitialize memoization
for (int i = 0; i < k_maxNumberOfCells; i++) {
for (int i = 0; i < k_maxNumberOfRows; i++) {
m_layouts[i] = Layout();
}
m_expression = e;
}

Poincare::Layout ExpressionsListController::layoutAtIndex(int index) {
if (m_layouts[index].isUninitialized()) {
computeLayoutAtIndex(index);
}
assert(!m_layouts[index].isUninitialized());
return m_layouts[index];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ class ExpressionsListController : public ListController {
KDCoordinate rowHeight(int j) override;
int typeAtLocation(int i, int j) override { return 0; }
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
int numberOfRows() const override;

// IllustratedListController
void setExpression(Poincare::Expression e) override;

protected:
constexpr static int k_maxNumberOfCells = 4;
constexpr static int k_maxNumberOfRows = 5;
int textAtIndex(char * buffer, size_t bufferSize, int index) override;
Poincare::Expression m_expression;
// Memoization of layouts
mutable Poincare::Layout m_layouts[k_maxNumberOfCells];
mutable Poincare::Layout m_layouts[k_maxNumberOfRows];
private:
Poincare::Layout layoutAtIndex(int index);
virtual void computeLayoutAtIndex(int index) = 0;
virtual I18n::Message messageAtIndex(int index) = 0;
// Cells
ExpressionTableCellWithPointer m_cells[k_maxNumberOfCells];
ExpressionTableCellWithPointer m_cells[k_maxNumberOfRows];
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Calculation {

IllustratedListController::IllustratedListController(EditExpressionController * editExpressionController) :
ListController(editExpressionController, this),
m_calculationStore(m_calculationStoreBuffer, k_calculationStoreBufferSize),
m_additionalCalculationCells{}
{
for (int i = 0; i < k_maxNumberOfAdditionalCalculations; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class IllustratedListController : public ListController, public SelectableTableV
private:
int textAtIndex(char * buffer, size_t bufferSize, int index) override;
virtual CodePoint expressionSymbol() const = 0;
// Set the size of the buffer needed to store the additional calculation
constexpr static int k_maxNumberOfAdditionalCalculations = 4;
constexpr static int k_calculationStoreBufferSize = k_maxNumberOfAdditionalCalculations * (sizeof(Calculation) + Calculation::k_numberOfExpressions * Constant::MaxSerializedExpressionSize + sizeof(Calculation *));
char m_calculationStoreBuffer[k_calculationStoreBufferSize];
// Cells
virtual HighlightCell * illustrationCell() = 0;
ScrollableThreeExpressionsCell m_additionalCalculationCells[k_maxNumberOfAdditionalCalculations];
Expand Down
Loading

0 comments on commit 9b17d1b

Please sign in to comment.