Casio fx-CG series port (#324)

* Initial test - working on Linux

* Try to make it work with liba

* Stop using liba and the filesystem

* IT WORKS

* Key input, full res, fix some of the crashes

* Fix the hang when doing calculations

* Add some more key mappings

* Fix the square root issue

* Icons

* Better key mappings, brightness control, better gamma correction, more effficient framebuffer

* Cleanup stage 1

* Cleanup stage 2

* Make the build system build a g3a

* Make it not exit when you press the menu button

* Add Casio port to README

* Use omega-master instead of omega-dev

* Fix mistake with cherry-picking in the README

* Fix internal storage crash

* Fix compile error on Numworks calculators

* Upsilon branding

* Sharper icon

* Make the CI work

* Add power off and improve menu

* Map Alpha + up/down to the brightness shortcut

* Add missing file

* Fix web CI build

* Revert "Fix web CI build"

This reverts commit f19657d9fc.

* Change "prizm" to "fxcg"

* Add FASTLOAD option for Add-in Push

* Add some charatcers to the catalog on Casio and improve key mappings

* Build with -Os -flto

* Disable LTO for now as it's causing crashes

* Put back the fonts I accidently changed

I'd like to add an option for this though as I prefer the ones from Epsilon
This commit is contained in:
circuit10
2023-05-10 17:28:18 +01:00
committed by GitHub
parent aadcd37f31
commit b44a95a9b3
77 changed files with 1617 additions and 49 deletions

View File

@@ -1,5 +1,11 @@
PythonPound = "Kommentar"
PythonPercent = "Modulo"
PythonColon = "Doppelpunkt"
PythonSemicon = "Semikolon"
PythonExclamationMark = "Ausrufezeichen"
PythonLessThan = "Kleiner als"
PythonGreaterThan = "Größer als"
PythonQuestionMark = "Fragezeichen"
Python1J = "Imaginäres i"
PythonLF = "Zeilenvorschub"
PythonTab = "Tabulator"

View File

@@ -1,5 +1,11 @@
PythonPound = "Comment"
PythonPercent = "Modulo"
PythonColon = "Colon"
PythonSemicon = "Semicolon"
PythonExclamationMark = "Exclamation mark"
PythonLessThan = "Less than"
PythonGreaterThan = "Greater than"
PythonQuestionMark = "Question mark"
Python1J = "Imaginary i"
PythonLF = "Line feed"
PythonTab = "Tabulation"

View File

@@ -1,5 +1,11 @@
PythonPound = "Comment"
PythonPercent = "Modulo"
PythonColon = "Colon"
PythonSemicon = "Semicolon"
PythonExclamationMark = "Exclamation mark"
PythonLessThan = "Less than"
PythonGreaterThan = "Greater than"
PythonQuestionMark = "Question mark"
Python1J = "Imaginary i"
PythonLF = "Line feed"
PythonTab = "Tabulation"

View File

@@ -1,5 +1,11 @@
PythonPound = "Commentaire"
PythonPercent = "Modulo"
PythonColon = "Deux-points"
PythonSemicon = "Point-virgule"
PythonExclamationMark = "Point d'exclamation"
PythonLessThan = "Inférieur à"
PythonGreaterThan = "Supérieur à"
PythonQuestionMark = "Point d'interrogation"
Python1J = "i complexe"
PythonLF = "Saut à la ligne"
PythonTab = "Tabulation"

View File

@@ -1,5 +1,11 @@
PythonPound = "Megjegyzés"
PythonPercent = "Modulo"
PythonColon = "Kettőspont"
PythonSemicon = "Pontosvessző"
PythonExclamationMark = "Felkiáltójel"
PythonLessThan = "Kisebb mint"
PythonGreaterThan = "Nagyobb mint"
PythonQuestionMark = "Kérdőjel"
Python1J = "Képzeletbeli i"
PythonLF = "Enter"
PythonTab = "Táblázat"

View File

@@ -1,5 +1,11 @@
PythonPound = "Commento"
PythonPercent = "Modulo"
PythonColon = "Due punti"
PythonSemicon = "Punto e virgola"
PythonExclamationMark = "Punto esclamativo"
PythonLessThan = "Minore di"
PythonGreaterThan = "Maggiore di"
PythonQuestionMark = "Punto interrogativo"
Python1J = "Unità immaginaria"
PythonLF = "Nuova riga"
PythonTab = "Tabulazione"

View File

@@ -1,5 +1,11 @@
PythonPound = "Opmerkingen"
PythonPercent = "Modulo"
PythonColon = "Dubbele punt"
PythonSemicon = "Puntkomma"
PythonExclamationMark = "Uitroepteken"
PythonLessThan = "Kleiner dan"
PythonGreaterThan = "Groter dan"
PythonQuestionMark = "Vraagteken"
Python1J = "Imaginaire i"
PythonLF = "Nieuwe regel"
PythonTab = "Tabulatie"

View File

@@ -1,5 +1,11 @@
PythonPound = "Comentário"
PythonPercent = "Módulo"
PythonColon = "Dois pontos"
PythonSemicon = "Ponto e vírgula"
PythonExclamationMark = "Ponto de exclamação"
PythonLessThan = "Menor que"
PythonGreaterThan = "Maior que"
PythonQuestionMark = "Ponto de interrogação"
Python1J = "i Complexo"
PythonLF = "Nova linha"
PythonTab = "Tabulação"

View File

@@ -1,6 +1,12 @@
PythonCommandAmpersand = "&"
PythonCommandLF = "\\n"
PythonCommandPercent = "%"
PythonCommandColon = ":"
PythonCommandSemicon = ";"
PythonCommandExclamationMark = "!"
PythonCommandLessThan = "<"
PythonCommandGreaterThan = ">"
PythonCommandQuestionMark = "?"
PythonCommandPound = "#"
PythonCommandSingleQuote = "'x'"
PythonCommandSymbolExp = "^"

View File

@@ -503,6 +503,15 @@ const ToolboxMessageTree modulesChildren[] = {
const ToolboxMessageTree catalogChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandPound, I18n::Message::PythonPound, false),
#ifdef _FXCG
// There is no question mark button on the fx-CG calculators
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColon, I18n::Message::PythonColon, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSemicon, I18n::Message::PythonSemicon, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandExclamationMark, I18n::Message::PythonExclamationMark, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandLessThan, I18n::Message::PythonLessThan, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGreaterThan, I18n::Message::PythonGreaterThan, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandQuestionMark, I18n::Message::PythonQuestionMark, false),
#endif
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandPercent, I18n::Message::PythonPercent, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommand1J, I18n::Message::Python1J, false),
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandLF, I18n::Message::PythonLF, false),

View File

@@ -18,7 +18,13 @@ public:
* 10.0938275501223 which are hopefully rare enough.
* TODO: The drawCurve algorithm should use the derivative function to know
* how fast the function moves... */
#ifndef _FXCG
static constexpr float k_graphStepDenominator = 10.0938275501223f;
#else
// This value rounded down has to be a factor of the horizontal resolution / 2
// On the Casio calculator the resolution is 396 pixels, so 11 is close but works
static constexpr float k_graphStepDenominator = 11.0938275501223f;
#endif
GraphView(Shared::InteractiveCurveViewRange * graphRange,
Shared::CurveViewCursor * cursor, Shared::BannerView * bannerView, Shared::CursorView * cursorView);

View File

@@ -276,7 +276,7 @@ void Controller::tableViewDidChangeSelection(SelectableTableView * t, int previo
* (so the previous one is always visible). */
int appIndex = (t->selectedColumn()+t->selectedRow()*k_numberOfColumns)+1;
if (appIndex >= this->numberOfIcons()+1) {
t->selectCellAtLocation((this->numberOfIcons()%3)-1, (this->numberOfIcons() / k_numberOfColumns));
t->selectCellAtLocation((this->numberOfIcons()%k_numberOfColumns)-1, (this->numberOfIcons() / k_numberOfColumns));
}
}

View File

@@ -47,10 +47,19 @@ private:
static constexpr KDCoordinate k_sideMargin = 4;
static constexpr KDCoordinate k_bottomMargin = 14;
static constexpr KDCoordinate k_indicatorMargin = 61;
#ifndef _FXCG
static constexpr int k_numberOfColumns = 3;
static constexpr int k_maxNumberOfCells = 16;
static constexpr int k_cellHeight = 104;
static constexpr int k_cellWidth = 104;
#else
// A different screen resolution so different dimensions
static constexpr int k_numberOfColumns = 4;
static constexpr int k_cellHeight = 96;
static constexpr int k_cellWidth = 97;
#endif
static constexpr int k_maxNumberOfCells = 16;
ContentView m_view;
AppCell m_cells[k_maxNumberOfCells];
App * m_app;

View File

@@ -854,6 +854,10 @@ const ToolboxMessageTree Physics[] = {
const ToolboxMessageTree menu[] = {
#ifdef _FXCG
// There is no factorial button on the fx-CG calculators
ToolboxMessageTree::Leaf(I18n::Message::FactorialCommandWithArg, I18n::Message::Factorial, false, I18n::Message::FactorialCommand),
#endif
ToolboxMessageTree::Leaf(I18n::Message::AbsCommandWithArg, I18n::Message::AbsoluteValue),
ToolboxMessageTree::Leaf(I18n::Message::RootCommandWithArg, I18n::Message::NthRoot),
ToolboxMessageTree::Leaf(I18n::Message::LogCommandWithArg, I18n::Message::BasedLogarithm),

View File

@@ -57,7 +57,7 @@ public:
void deleteDistributionAndCalculation();
void initializeDistributionAndCalculation();
#if __EMSCRIPTEN__
#if (defined __EMSCRIPTEN__) || (defined _FXCG)
constexpr static int k_distributionAlignments[] = {alignof(BinomialDistribution),alignof(ExponentialDistribution), alignof(NormalDistribution), alignof(PoissonDistribution), alignof(UniformDistribution), 0};
constexpr static size_t k_distributionAlignment = max(k_distributionAlignments);
constexpr static int k_calculationAlignments[] = {alignof(LeftIntegralCalculation),alignof(FiniteIntegralCalculation), alignof(RightIntegralCalculation), 0};

View File

@@ -1,5 +1,6 @@
#include "about_controller.h"
#include "../../../python/src/py/mpconfig.h"
#include "poincare/division.h"
#include <assert.h>
#include <cmath>
#include <apps/settings/main_controller.h>

View File

@@ -30,7 +30,10 @@ bool DateTimeController::handleEvent(Ion::Events::Event event) {
if (selectedRow() == 0) {
clockEnabled = !clockEnabled;
if (clockEnabled) {
#ifndef _FXCG
// This doesn't apply on Casio calculators
Container::activeApp()->displayWarning(I18n::Message::RTCWarning1, I18n::Message::RTCWarning2);
#endif
}
Ion::RTC::setMode(clockEnabled ? Ion::RTC::Mode::HSE : Ion::RTC::Mode::Disabled);
}

View File

@@ -121,3 +121,4 @@ CatalyticActivityDimension = "Katalitikus aktivitás"
SurfaceDimension = "Felület"
VolumeDimension = "Hangerő"
SpeedDimension = "Sebesség"
Factorial = "Faktorál"

View File

@@ -121,3 +121,4 @@ CatalyticActivityDimension = "Attività catalitica"
SurfaceDimension = "Superficie"
VolumeDimension = "Volume"
SpeedDimension = "Velocità"
Factorial = "Fattoriale"

View File

@@ -121,3 +121,4 @@ CatalyticActivityDimension = "Katalytische activiteit"
SurfaceDimension = "Oppervlak"
VolumeDimension = "Volume"
SpeedDimension = "Snelheid"
Factorial = "Faculteit"

View File

@@ -125,6 +125,8 @@ DotCommandWithArg = "dot(u,v)"
E = "e"
Equal = "="
FactorCommandWithArg = "factor(n)"
FactorialCommand = "!"
FactorialCommandWithArg = "n!"
FccId = "FCC ID"
FloorCommandWithArg = "floor(x)"
FracCommandWithArg = "frac(x)"

View File

@@ -270,7 +270,7 @@ void ContinuousFunction::rangeForDisplay(float * xMin, float * xMax, float * yMi
}
if (!basedOnCostlyAlgorithms(context)) {
Zoom::ValueAtAbscissa evaluation = [](float x, Context * context, const void * auxiliary) {
Zoom::ValueAtAbscissa evaluation = [](float x, Context * context, const void * auxiliary) -> float {
/* When evaluating sin(x)/x close to zero using the standard sine function,
* one can detect small variations, while the cardinal sine is supposed to be
* locally monotonous. To smooth our such variations, we round the result of

View File

@@ -65,7 +65,11 @@ void ContinuousFunctionCache::ComputeNonCartesianSteps(float * tStep, float * tC
const int numberOfWholeSteps = static_cast<int>(Graph::GraphView::k_graphStepDenominator);
static_assert(numberOfCacheablePoints % numberOfWholeSteps == 0, "numberOfCacheablePoints should be a multiple of numberOfWholeSteps for optimal caching");
const int multiple = numberOfCacheablePoints / numberOfWholeSteps;
// Ignore this on Casio calculators for now, as the screen resolution breaks this
// TODO: fix this. if it's possible
#ifndef _FXCG
static_assert(multiple && !(multiple & (multiple - 1)), "multiple should be a power of 2 for optimal caching");
#endif
/* Define cacheStep such that every whole graph steps are equally divided
* For instance, with :
* graphStepDenominator = 10.1

View File

@@ -49,7 +49,12 @@ protected:
static constexpr KDCoordinate k_cellWidth = Poincare::PrintFloat::glyphLengthForFloatWithPrecision(Poincare::Preferences::LargeNumberOfSignificantDigits) * 7 + 2*Metric::CellMargin + Metric::TableSeparatorThickness; // KDFont::SmallFont->glyphSize().width() = 7
constexpr static int k_maxNumberOfEditableCells = (Ion::Display::Width/k_cellWidth+2) * ((Ion::Display::Height - Metric::TitleBarHeight - Metric::TabHeight)/k_cellHeight+2);
#ifndef _FXCG
constexpr static int k_numberOfTitleCells = 4;
#else
// This is different here due to the changed screen resolution
constexpr static int k_numberOfTitleCells = 5;
#endif
static constexpr int k_titleCellType = 0;
static constexpr int k_editableCellType = 1;

View File

@@ -87,7 +87,7 @@ private:
// Number of cells
constexpr static int k_maxNumberOfVisibleCells = (Ion::Display::Height - 3 * Metric::TitleBarHeight) / k_defaultCellHeight + 1; // When displaying approximate solutions for cos(x) = 0 between 0 and 1800 and scrolling down
static_assert(k_maxNumberOfVisibleCells == 10, "k_maxNumberOfVisibleCells has changed"); //This assert is just for information purposes
// static_assert(k_maxNumberOfVisibleCells == 10, "k_maxNumberOfVisibleCells has changed"); //This assert is just for information purposes
static_assert(k_maxNumberOfVisibleCells <= EquationStore::k_maxNumberOfSolutions + Poincare::Expression::k_maxNumberOfVariables, "We can reduce the number of cells in Solver:SolutionsController.");
constexpr static int k_maxNumberOfSymbols = EquationStore::k_maxNumberOfSolutions + Poincare::Expression::k_maxNumberOfVariables;
constexpr static int k_numberOfSymbolCells = k_maxNumberOfVisibleCells < k_maxNumberOfSymbols ? k_maxNumberOfVisibleCells : k_maxNumberOfSymbols;

View File

@@ -511,3 +511,4 @@ MagneticFluxQuantumTag = "Magnetisches Fluss-Quantum"
ConductanceQuantumTag = "Leitwertquantum"
CirculationQuantumTag = "Auflage-Quantum"
MatricesAndVectors = "Matrizen und Vektoren"
Factorial = "Fakultät"

View File

@@ -511,3 +511,4 @@ HartreeConstantTag = "Hartree Constant"
MagneticFluxQuantumTag = "Magnetic Flux Quantum"
ConductanceQuantumTag = "Conductance Quantum"
CirculationQuantumTag = "Circulation Quantum"
Factorial = "Factorial"

View File

@@ -511,3 +511,4 @@ MagneticFluxQuantumTag = "Flujo Magnético Cuántico"
ConductanceQuantumTag = "Conductancia Quantum"
CirculationQuantumTag = "Circulación Quantum"
MatricesAndVectors = "Matrices y vectores"
Factorial = "Factorial"

View File

@@ -515,3 +515,4 @@ MagneticFluxQuantumTag = "Quantum de Flux Magnétique"
ConductanceQuantumTag = "Quantum de Conductance"
CirculationQuantumTag = "Quantum de Circulation"
MatricesAndVectors = "Matrices et vecteurs"
Factorial = "Factorielle"

View File

@@ -511,3 +511,4 @@ MagneticFluxQuantumTag = "Fluxo Magnético Quântico"
ConductanceQuantumTag = "Quantum de Conduta"
CirculationQuantumTag = "Quantum de Circulação"
MatricesAndVectors = "Matrizes e vetores"
Factorial = "Fatorial"