diff --git a/qt_gui.png b/qt_gui.png
index f24dfc5..2cbbb69 100644
Binary files a/qt_gui.png and b/qt_gui.png differ
diff --git a/qt_gui/main.qml b/qt_gui/main.qml
index fdad647..b64fbbe 100644
--- a/qt_gui/main.qml
+++ b/qt_gui/main.qml
@@ -19,7 +19,7 @@ ApplicationWindow
Rectangle{
width: 100
height: 25
- color: "red"
+ color: "#ff9494"
Text {text: "Quit"}
MouseArea {
onClicked: Qt.quit()
@@ -56,10 +56,21 @@ ApplicationWindow
id: key_key;
width: 100;
height: 100;
- color: "gray"
+ color: getBackgroundColor(parent.objectName, index)
border { width: 1; color: "black" }
Text {
- text: {getText(parent.parent.objectName, index)}
+ horizontalAlignment: Text.AlignHCenter
+ font.pointSize: 16
+ color: "gray"
+ text: {getShiftedText(parent.parent.objectName, index) + "
"}
+ textFormat: Text.RichText
+ anchors.centerIn: parent
+ }
+ Text {
+ horizontalAlignment: Text.AlignHCenter
+ font.pointSize: 24
+ text: {"
" + getText(parent.parent.objectName, index) + "
"}
+ textFormat: Text.RichText
anchors.centerIn: parent
}
MouseArea {
@@ -74,13 +85,37 @@ ApplicationWindow
function getText(row, col) {
var keys = [
- ["Shift", "x<->y", "+/-", "C"],
- ["7", "8", "9", "/"],
- ["4", "5", "6", "*"],
- ["1", "2", "3", "-"],
- ["0", ".", "Enter", "+"]
+ ["Shift", "x ⇄ y", "±", "←"],
+ ["7", "8", "9", "÷"],
+ ["4", "5", "6", "×"],
+ ["1", "2", "3", "-"],
+ ["0", ".", "Enter", "+"]
]
- return keys[row][col]
+ return "" + keys[row][col] + ""
+ }
+
+ function getShiftedText(row, col) {
+ var shifted_keys = [
+ ["Shift", "1/x", " √x ", "CLx"],
+ ["yx ", "ln(x)", "log(x)", ""],
+ ["", "ex", "10x", ""],
+ ["", "", "", ""],
+ ["off", "", "", ""]
+ ]
+
+ return "" + shifted_keys[row][col] + ""
+ }
+
+ function getBackgroundColor(row, col) {
+ var background_color = [
+ ["white", "white", "white", "#ff9494"],
+ ["#eeeeee", "#eeeeee", "#eeeeee", "white"],
+ ["#eeeeee", "#eeeeee", "#eeeeee", "white"],
+ ["#eeeeee", "#eeeeee", "#eeeeee", "white"],
+ ["#eeeeee", "#eeeeee", "white", "white"]
+ ]
+
+ return background_color[row][col]
}
}
diff --git a/src/lcd.h b/src/lcd.h
index 97583a3..735e4ad 100644
--- a/src/lcd.h
+++ b/src/lcd.h
@@ -16,6 +16,11 @@ void LCD_Clear(void);
void LCD_GoTo(uint8_t row, uint8_t col);
void LCD_OutString(__xdata const char* string, uint8_t max_chars);
+#ifdef DESKTOP
+void LCD_OutString_Initial(__xdata const char* string, uint8_t max_chars);
+#else
+#define LCD_OutString_Initial(a, b) LCD_OutString(a, b)
+#endif
short TERMIO_PutChar(unsigned char letter);
void LCD_OutNibble(uint8_t x);
void LCD_ClearToEnd(uint8_t curr_row);
diff --git a/src/lcd_emulator.c b/src/lcd_emulator.c
index ed73a92..d3aa11c 100644
--- a/src/lcd_emulator.c
+++ b/src/lcd_emulator.c
@@ -15,6 +15,8 @@
static uint8_t lcd_row, lcd_col;
static char lcd_buf[MAX_ROWS][MAX_CHARS_PER_LINE];
+static char enable_checks = 1;
+
const char* get_lcd_buf(void){
return &lcd_buf[0][0];
}
@@ -71,6 +73,12 @@ void LCD_OutString(const char *string, uint8_t max_chars) {
}
}
+void LCD_OutString_Initial(const char *string, uint8_t max_chars) {
+ enable_checks = 0;
+ LCD_OutString(string, max_chars);
+ enable_checks = 1;
+}
+
static int is_valid_character(char letter){
if (isdigit(letter)){
return 1;
@@ -78,6 +86,8 @@ static int is_valid_character(char letter){
return 1;
} else if(letter == '.' || letter == ' ' || letter == '-'){
return 1;
+ } else if(letter == '^'){
+ return 1;
}
return 0;
@@ -94,7 +104,7 @@ short TERMIO_PutChar(unsigned char letter) {
}
}
//warn if unknown character
- if (!is_valid_character(letter)) {
+ if (!is_valid_character(letter) && enable_checks) {
printf("\nerror @%d,%d, invalid character %d\n",
lcd_row, lcd_col, letter);
}
diff --git a/src/main.c b/src/main.c
index ef55892..72d74df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -208,7 +208,7 @@ int main()
ExpBuf[0] = 0;
ExpBuf[1] = 0;
- LCD_OutString(VER_STR, 32);
+ LCD_OutString_Initial(VER_STR, 32);
#ifdef DESKTOP
LcdAvailable.release();
#endif