From f5e6dbb8b0c3b1e548fba3a9633bdd1865ba87e9 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:58:13 +0100 Subject: [PATCH 01/13] add function for displaying strings, all other functions adapted --- .../Community/devices/kav_rudder.device.json | 5 + KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 162 ++++++++++-------- KAV_Simulation/KAV_A3XX_RUDDER_LCD.h | 10 +- 3 files changed, 100 insertions(+), 77 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rudder.device.json b/KAV_Simulation/Community/devices/kav_rudder.device.json index d928e43..d20f92d 100644 --- a/KAV_Simulation/Community/devices/kav_rudder.device.json +++ b/KAV_Simulation/Community/devices/kav_rudder.device.json @@ -55,6 +55,11 @@ "id": 6, "label": "Set value w/ 'L' or 'R'", "description": "$ will set the value of the display with the 'L' or 'R' character" + }, + { + "id": 7, + "label": "Set value w/ 'L' or 'R'", + "description": "$ as string will be displayed with the 'L' or 'R' character, e.g. 'L12.3'" } ] } diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index e3fc114..0b971b8 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -1,4 +1,5 @@ #include "KAV_A3XX_RUDDER_LCD.h" +#include "KAV_GetDigitPattern.h" #define DIGIT_LR 0 #define DIGIT_TWO 1 @@ -66,6 +67,20 @@ void KAV_A3XX_RUDDER_LCD::refreshLCD(uint8_t address) ht_rad_tcas.write(address * 2, buffer[address], 8); } +/** + * Refresh the LCD + * After a change is made to a segment, the display must be refreshed so that + * the change is visible. + * @param address The address to refresh + * @param digits The number of digits to refresh + */ +void KAV_A3XX_RUDDER_LCD::refreshLCD(uint8_t address, uint8_t digits) +{ + for (uint8_t i = 0; i < digits; i++) { + refreshLCD(address + i); + } +} + /** * Clear the LCD * This function clears the LCD and resets the buffer. @@ -91,8 +106,12 @@ void KAV_A3XX_RUDDER_LCD::clearDigit(uint8_t address) void KAV_A3XX_RUDDER_LCD::setLeft(bool enabled) { if (enabled) { - displayDigit(DIGIT_LR, 11); + getDigitPattern(buffer, DIGIT_LR, (char*)"L", 1); + } else { + // enable also clearing the decimal point if 'R' was displayed before + getDigitPattern(buffer, DIGIT_LR, (char*)" ", 1,(1<<0)); } + refreshLCD(DIGIT_LR); } /** @@ -102,8 +121,12 @@ void KAV_A3XX_RUDDER_LCD::setLeft(bool enabled) void KAV_A3XX_RUDDER_LCD::setRight(bool enabled) { if (enabled) { - displayDigit(DIGIT_LR, 12); + // 'R' is not definded in char table, use 'A' and decimal point to set required segements + getDigitPattern(buffer, DIGIT_LR, (char*)"A.", 2, (1<<0)); + } else { + getDigitPattern(buffer, DIGIT_LR, (char*)" ", 1,(1<<0)); } + refreshLCD(DIGIT_LR); } /** @@ -119,38 +142,28 @@ void KAV_A3XX_RUDDER_LCD::setDot(bool enabled) /** * Set the value of the LCD using an integer. + * 'L' or 'R' must be set AFTER this function call * @param value The value to display */ -void KAV_A3XX_RUDDER_LCD::setValueInt(int16_t value) +void KAV_A3XX_RUDDER_LCD::setValue(int16_t value) { + setValue((float)value/10); +} + +/** + * Set the value of the LCD using an integer. + * 'L' or 'R' must be set AFTER this function call + * @param value The value to display + */ +void KAV_A3XX_RUDDER_LCD::setValue(float value) +{ + char bufferDigits[10] = {0}; // Convert the number from negative to positive if it's negative. if (value < 0) { - value = value * -1; - } - - // Display the value. - if (value > 999) - value = 999; - displayDigit(DIGIT_FOUR, (value % 10)); - if (value > 9) - { - value = value / 10; - displayDigit(DIGIT_THREE, (value % 10)); - } - else - { - displayDigit(DIGIT_THREE, 0); - } - if (value > 9) - { - displayDigit(DIGIT_TWO, (value / 10)); - } - else - { - displayDigit(DIGIT_TWO, 13); + value = -value; } - - setDot(true); + dtostrf(value, 4, 1, bufferDigits); + showLandRValue(bufferDigits); } // Show values as a combined function @@ -158,20 +171,18 @@ void KAV_A3XX_RUDDER_LCD::setValueInt(int16_t value) * Show the value on the display with the 'L' character enabled using an integer. * @param value The value to display */ -void KAV_A3XX_RUDDER_LCD::showLeftValueInt(uint16_t value) +void KAV_A3XX_RUDDER_LCD::showLeftValue(uint16_t value) { - setValueInt(value); - setLeft(true); + showLandRValue((float)value / -10); } /** * Show the value on the display with the 'R' character enabled using an integer. * @param value The value to display */ -void KAV_A3XX_RUDDER_LCD::showRightValueInt(uint16_t value) +void KAV_A3XX_RUDDER_LCD::showRightValue(uint16_t value) { - setValueInt(value); - setRight(true); + showLandRValue((float)value/10); } /** @@ -180,57 +191,57 @@ void KAV_A3XX_RUDDER_LCD::showRightValueInt(uint16_t value) */ void KAV_A3XX_RUDDER_LCD::showLandRValue(int16_t value) { + showLandRValue((float)value/10); +} + +/** + * Show the value on the display with the 'L' or 'R' character enabled using an integer. + * @param value The value to display +*/ +void KAV_A3XX_RUDDER_LCD::showLandRValue(float value) +{ + char bufferDigits[10] = {0}; if (value < 0) { setLeft(true); - // Convert a negative value to a positive one to display it. - value = value * -1; + value = -value; + bufferDigits[0] = 'L'; } else { setRight(true); + bufferDigits[0] = 'R'; } - setValueInt(value); + dtostrf(value, 4, 1, &bufferDigits[1]); + showLandRValue(bufferDigits); } -// Global Functions /** - * A list of the binary patterns to show different characters on the LCD. - */ -uint8_t digitPatternRudder[14] = { - 0b11101011, // 0 - 0b01100000, // 1 - 0b11000111, // 2 - 0b11100101, // 3 - 0b01101100, // 4 - 0b10101101, // 5 or S - 0b10101111, // 6 - 0b11100000, // 7 - 0b11101111, // 8 - 0b11101101, // 9 - 0b00000100, // - - 0b00001011, // L - 0b11111110, // R - 0b00000000, // blank -}; - -/** - * Display a digit on a specific address. - * @param address The address to display the digit on - * @param digit The digit to display - * @see digitPatternRudder - */ -void KAV_A3XX_RUDDER_LCD::displayDigit(uint8_t address, uint8_t digit) + * Show the value on the display, checks for 'L' or 'R' character. + * @param value The value to display +*/ +void KAV_A3XX_RUDDER_LCD::showLandRValue(char *value) { - // This ensures that anything over 13 is turned to 'blank', and as it's unsigned, anything less than 0 will become 255, and therefore, 'blank'. - if (digit > 13) - digit = 13; - - buffer[address] = digitPatternRudder[digit]; - - refreshLCD(address); + if (value[0] == 'L') + { + setLeft(true); + getDigitPattern(buffer, DIGIT_TWO, &value[1], 3, (1<<1)); + } + else if (value[0] == 'R') + { + setRight(true); + getDigitPattern(buffer, DIGIT_TWO, &value[1], 3, (1<<1)); + } + else { + setLeft(false); + setRight(false); + getDigitPattern(buffer, DIGIT_TWO, value, 3, (1<<1)); + } + refreshLCD(DIGIT_LR, 4); } +// Global Functions + /** * Handle MobiFlight Commands * This function shouldn't be called be a user, it should only be called by the @@ -264,12 +275,15 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) setDot((uint16_t)data); else if (messageID == 3) // This one needs to keep it's sign, so using `int16_t`. - setValueInt((int16_t)data); + setValue((int16_t)data); else if (messageID == 4) - showLeftValueInt((uint16_t)data); + showLeftValue((uint16_t)data); else if (messageID == 5) - showRightValueInt((uint16_t)data); + showRightValue((uint16_t)data); else if (messageID == 6) // This one needs to keep it's sign, so using `int16_t`. showLandRValue((int16_t)data); + else if (messageID == 7) + // This one shows the string and checks for 'L' or 'R' as first character + showLandRValue(setPoint); } diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h index d8e5b2c..85f174b 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h @@ -24,6 +24,7 @@ class KAV_A3XX_RUDDER_LCD { // Methods void displayDigit(uint8_t address, uint8_t digit); void refreshLCD(uint8_t address); + void refreshLCD(uint8_t address, uint8_t digits); public: // Constructor @@ -43,10 +44,13 @@ class KAV_A3XX_RUDDER_LCD { // Set Dot Function void setDot(bool enabled); // Set value function - void setValueInt(int16_t value); + void setValue(int16_t value); + void setValue(float value); // Show Rudder Value function - void showLeftValueInt(uint16_t value); - void showRightValueInt(uint16_t value); + void showLeftValue(uint16_t value); + void showRightValue(uint16_t value); void showLandRValue(int16_t value); + void showLandRValue(float value); + void showLandRValue(char* value); }; From 409e326a9bf552465dcd085f527eda042532cb69 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:01:14 +0100 Subject: [PATCH 02/13] additional message for string output, all functions changed accordingly --- .../devices/kav_rad_tcas.device.json | 5 + KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp | 136 +++++++----------- KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h | 5 +- 3 files changed, 60 insertions(+), 86 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rad_tcas.device.json b/KAV_Simulation/Community/devices/kav_rad_tcas.device.json index 67d7529..19c62ed 100644 --- a/KAV_Simulation/Community/devices/kav_rad_tcas.device.json +++ b/KAV_Simulation/Community/devices/kav_rad_tcas.device.json @@ -40,6 +40,11 @@ "id": 3, "label": "Set value TCAS", "description": "$ will show the value on the display for TCAS" + }, + { + "id": 4, + "label": "Set value as string", + "description": "$ is shown as string" } ] } diff --git a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp index 760b8dd..69e2a92 100644 --- a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp @@ -1,4 +1,5 @@ #include "KAV_A3XX_RAD_TCAS_LCD.h" +#include "KAV_GetDigitPattern.h" #define DIGIT_ONE 0 #define DIGIT_TWO 1 @@ -68,15 +69,29 @@ void KAV_A3XX_RAD_TCAS_LCD::refreshLCD(uint8_t address) ht_rad_tcas.write(address * 2, buffer[address], 8); } +/** + * Refresh the LCD + * After a change is made to a segment, the display must be refreshed so that + * the change is visible. + * @param address The address to refresh + * @param digits The number of digits to refresh + */ +void KAV_A3XX_RAD_TCAS_LCD::refreshLCD(uint8_t address, uint8_t digits) +{ + for (uint8_t i = 0; i < digits; i++) { + refreshLCD(address + i); + } +} + /** * Clear the LCD * This function clears the LCD and resets the buffer. */ void KAV_A3XX_RAD_TCAS_LCD::clearLCD() { - for (uint8_t i = 0; i < ht_rad_tcas.MAX_ADDR; i++) - ht_rad_tcas.write(i, 0); - memset(buffer, 0, BUFFER_SIZE_MAX); + char bufferDigits[12] = {0}; + snprintf(bufferDigits, 12, " "); + showValue(bufferDigits); } void KAV_A3XX_RAD_TCAS_LCD::clearDigit(uint8_t address) @@ -122,48 +137,35 @@ void KAV_A3XX_RAD_TCAS_LCD::setAllDots(bool enabled) /** * Set the value of the LCD using an integer for radio (6 characters). + * The dots get NOT cleared. If required use showRadio() * @param value The value to display */ void KAV_A3XX_RAD_TCAS_LCD::setRadioValue(uint32_t value) { + char bufferDigits[12] = {0}; if (value == 0) - { - displayDigit(DIGIT_ONE, 11); - displayDigit(DIGIT_TWO, 13); - displayDigit(DIGIT_THREE, 14); - displayDigit(DIGIT_FOUR, 15); - displayDigit(DIGIT_FIVE, 14); - displayDigit(DIGIT_SIX, 11); - } else { - if (value > 999999) - value = 999999; - displayDigit(DIGIT_SIX, (value % 10)); - value = value / 10; - displayDigit(DIGIT_FIVE, (value % 10)); - value = value / 10; - displayDigit(DIGIT_FOUR, (value % 10)); - value = value / 10; - displayDigit(DIGIT_THREE, (value % 10)); - value = value / 10; - displayDigit(DIGIT_TWO, (value % 10)); - displayDigit(DIGIT_ONE, (value / 10)); - } + snprintf(bufferDigits, 12, "000000"); + else + dtostrf((float)value/1000, 6, 3, bufferDigits); + + getDigitPattern(buffer, DIGIT_ONE, bufferDigits, 6); + refreshLCD(DIGIT_ONE, 6); } /** * Set the value of the LCD using an integer for TCAS (4 characters). + * The dots get NOT cleared. If required use showTcas() * @param value The value to display */ void KAV_A3XX_RAD_TCAS_LCD::setTcasValue(uint16_t value) { + char bufferDigits[12] = {0}; if (value > 9999) value = 9999; - displayDigit(DIGIT_FIVE, (value % 10)); - value = value / 10; - displayDigit(DIGIT_FOUR, (value % 10)); - value = value / 10; - displayDigit(DIGIT_THREE, (value % 10)); - displayDigit(DIGIT_TWO, (value / 10)); + + snprintf(bufferDigits, 12, " %04d ", value); + getDigitPattern(buffer, DIGIT_ONE, bufferDigits, 6); + refreshLCD(DIGIT_ONE, 6); } // Show values as a combined function @@ -174,11 +176,12 @@ void KAV_A3XX_RAD_TCAS_LCD::setTcasValue(uint16_t value) */ void KAV_A3XX_RAD_TCAS_LCD::showRadio(uint32_t value) { - setRadioValue(value); + char bufferDigits[12] = {0}; if (value == 0) - setRadioDot(false); + snprintf(bufferDigits, 12, "000.000"); else - setRadioDot(true); + dtostrf((float)value/1000, 6, 3, bufferDigits); + showValue(bufferDigits); } /** @@ -188,10 +191,11 @@ void KAV_A3XX_RAD_TCAS_LCD::showRadio(uint32_t value) */ void KAV_A3XX_RAD_TCAS_LCD::showTcas(uint16_t value) { - setTcasValue(value); - displayDigit(DIGIT_ONE, 11); - displayDigit(DIGIT_SIX, 11); - setRadioDot(false); + char bufferDigits[12] = {0}; + if (value > 9999) + value = 9999; + snprintf(bufferDigits, 12, " %04d ", value); + showValue(bufferDigits); } /** @@ -200,58 +204,20 @@ void KAV_A3XX_RAD_TCAS_LCD::showTcas(uint16_t value) */ void KAV_A3XX_RAD_TCAS_LCD::showTest(bool enabled) { + char bufferDigits[12] = {0}; if (enabled) - { - setRadioValue(888888); - setAllDots(enabled); - } + snprintf(bufferDigits, 12, "8.8.8.8.8.8"); else - { - clearLCD(); - } + snprintf(bufferDigits, 12, " "); + showValue(bufferDigits); } -// Global Functions -/** - * A list of the binary patterns to show different characters on the LCD. - */ -uint8_t digitPatternRadTcas[16] = { - 0b11101011, // 0 - 0b01100000, // 1 - 0b11000111, // 2 - 0b11100101, // 3 - 0b01101100, // 4 - 0b10101101, // 5 or S - 0b10101111, // 6 - 0b11100000, // 7 - 0b11101111, // 8 - 0b11101101, // 9 - 0b00000100, // - - 0b00000000, // blank - 0b11001100, // small 0 (For V/S) - // Below are characters for 'dAtA' - 0b01100111, // d - 0b11101110, // A - 0b00001111, // t -}; - -/** - * Display a digit on a specific address. - * @param address The address to display the digit on - * @param digit The digit to display - * @see digitPatternRadTcas - */ -void KAV_A3XX_RAD_TCAS_LCD::displayDigit(uint8_t address, uint8_t digit) -{ - // This ensures that anything over 12 is turned to 'blank', and as it's unsigned, anything less than 0 will become 255, and therefore, 'blank'. - if (digit > 15) - digit = 11; - - buffer[address] = digitPatternRadTcas[digit]; - - refreshLCD(address); +void KAV_A3XX_RAD_TCAS_LCD::showValue(char* value) { + getDigitPattern(buffer, DIGIT_ONE, value, 6, (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5)); + refreshLCD(DIGIT_ONE, 6); } + /** * Handle MobiFlight Commands * This function shouldn't be called be a user, it should only be called by the @@ -284,4 +250,6 @@ void KAV_A3XX_RAD_TCAS_LCD::set(int16_t messageID, char *setPoint) showRadio((uint32_t)data); else if (messageID == 3) showTcas((uint16_t)data); -} \ No newline at end of file + else if (messageID == 4) + showValue(setPoint); +} diff --git a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h index c2ef79f..7590f67 100644 --- a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h +++ b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h @@ -22,9 +22,9 @@ class KAV_A3XX_RAD_TCAS_LCD { byte _DATA; // Methods - void handleMobiFlightCmd(char *string); void displayDigit(uint8_t address, uint8_t digit); void refreshLCD(uint8_t address); + void refreshLCD(uint8_t address, uint8_t digits); public: // Constructor @@ -46,8 +46,9 @@ class KAV_A3XX_RAD_TCAS_LCD { void setRadioValue(uint32_t value); void setTcasValue(uint16_t value); - // Show Rudder Value function + // Show Radio Value function void showRadio(uint32_t value); void showTcas(uint16_t value); void showTest(bool enabled); + void showValue(char* value); }; From d888e78356d73ea4e4cf79e8d7f7c31d0f41737d Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:22:21 +0200 Subject: [PATCH 03/13] better comment for powersaving, stop running connector --- KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index 0b971b8..7419195 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -258,9 +258,9 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) Each messageID has it's own value check for the messageID and define what to do. Important Remark! - MessageID == -1 will be send from the connector when Mobiflight is closed - Put in your code to shut down your custom device (e.g. clear a display) - MessageID == -2 will be send from the connector when PowerSavingMode is entered + MessageID == -2 will be send from the board when PowerSavingMode is set + Message will be "0" for leaving and "1" for entering PowerSavingMode + MessageID == -1 will be send from the connector when Connector stops running Put in your code to enter this mode (e.g. clear a display) ********************************************************************************** */ if (messageID == -1) From c7c5413ba48e734a035fb8e7334603003d57f02f Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:23:18 +0200 Subject: [PATCH 04/13] handle power safe mode, add clear/restore display --- .../Community/devices/kav_rudder.device.json | 5 +++ KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 34 ++++++++++++++----- KAV_Simulation/KAV_A3XX_RUDDER_LCD.h | 12 ++++--- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rudder.device.json b/KAV_Simulation/Community/devices/kav_rudder.device.json index d20f92d..1f83f5a 100644 --- a/KAV_Simulation/Community/devices/kav_rudder.device.json +++ b/KAV_Simulation/Community/devices/kav_rudder.device.json @@ -60,6 +60,11 @@ "id": 7, "label": "Set value w/ 'L' or 'R'", "description": "$ as string will be displayed with the 'L' or 'R' character, e.g. 'L12.3'" + }, + { + "id": 8, + "label": "Clear or restore the display'", + "description": "1 = clear the display, 0 = restore the display" } ] } diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index 7419195..3c67394 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -238,6 +238,16 @@ void KAV_A3XX_RUDDER_LCD::showLandRValue(char *value) getDigitPattern(buffer, DIGIT_TWO, value, 3, (1<<1)); } refreshLCD(DIGIT_LR, 4); + strncpy(_lastRudderValue, value, sizeof(_lastRudderValue)); +} + +void KAV_A3XX_RUDDER_LCD::setPowerSave(bool enabled) +{ + if (enabled) { + clearLCD(); + } else { + showLandRValue(_lastRudderValue); + } } // Global Functions @@ -264,26 +274,34 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) Put in your code to enter this mode (e.g. clear a display) ********************************************************************************** */ if (messageID == -1) - return; // Ignore for now, handle this condition later. + setPowerSave(true); else if (messageID == -2) - return; // Ignore for now, handle this condition later. + setPowerSave((bool)setPoint); else if (messageID == 0) - setLeft((uint16_t)data); + // setLeft((uint16_t)data); deprecated + return; else if (messageID == 1) - setRight((uint16_t)data); + // setRight((uint16_t)data); deprecated + return; else if (messageID == 2) - setDot((uint16_t)data); + // setDot((uint16_t)data); deprecated + return; else if (messageID == 3) // This one needs to keep it's sign, so using `int16_t`. - setValue((int16_t)data); + // setValue((int16_t)data); deprecated + return; else if (messageID == 4) showLeftValue((uint16_t)data); else if (messageID == 5) - showRightValue((uint16_t)data); + // showRightValue((uint16_t)data); deprecated + return; else if (messageID == 6) // This one needs to keep it's sign, so using `int16_t`. - showLandRValue((int16_t)data); + // showLandRValue((int16_t)data); deprecated + return; else if (messageID == 7) // This one shows the string and checks for 'L' or 'R' as first character showLandRValue(setPoint); + else if (messageID == 8) + setPowerSave((bool)setPoint); } diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h index 85f174b..c7dc9e0 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h @@ -14,12 +14,13 @@ class KAV_A3XX_RUDDER_LCD { private: // Fields - HT1621 ht_rad_tcas; + HT1621 ht_rad_tcas; uint8_t buffer[BUFFER_SIZE_MAX]; - bool _initialised; - byte _CS; - byte _CLK; - byte _DATA; + bool _initialised; + byte _CS; + byte _CLK; + byte _DATA; + char _lastRudderValue[10] = {}; // Methods void displayDigit(uint8_t address, uint8_t digit); @@ -37,6 +38,7 @@ class KAV_A3XX_RUDDER_LCD { void attach(byte CS, byte CLK, byte DATA); void detach(); void set(int16_t messageID, char *setPoint); + void setPowerSave(bool enabled); // Set 'L' and 'R' functions void setLeft(bool enabled); From 799c803bcaa7ff9f073b8df05ecd4ccc09578b75 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:25:33 +0200 Subject: [PATCH 05/13] restore accidentily deleted function setAnnunciatorTest() --- .../Community/devices/kav_rudder.device.json | 11 ++++++++--- KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 15 ++++++++++++++- KAV_Simulation/KAV_A3XX_RUDDER_LCD.h | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rudder.device.json b/KAV_Simulation/Community/devices/kav_rudder.device.json index 1f83f5a..803597d 100644 --- a/KAV_Simulation/Community/devices/kav_rudder.device.json +++ b/KAV_Simulation/Community/devices/kav_rudder.device.json @@ -58,13 +58,18 @@ }, { "id": 7, + "label": "(v2.5.3+) Annunciator Test Mode", + "description": "$ = 1 will display all Segments, $ = 0 will clear display" + }, + { + "id": 8, "label": "Set value w/ 'L' or 'R'", "description": "$ as string will be displayed with the 'L' or 'R' character, e.g. 'L12.3'" }, { - "id": 8, - "label": "Clear or restore the display'", - "description": "1 = clear the display, 0 = restore the display" + "id": 9, + "label": "Clear or restore LCD", + "description": "1 = Clear LCD, 0 = Show LCD" } ] } diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index 3f4d36e..f14f1dc 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -252,6 +252,16 @@ void KAV_A3XX_RUDDER_LCD::setPowerSave(bool enabled) // Global Functions +void KAV_A3XX_RUDDER_LCD::setAnnunciatorTest(bool enabled) +{ + if (enabled) { + for (uint8_t i = 0; i < ht_rudder.MAX_ADDR; i++) + ht_rudder.write(i, 0xFF); + } else { + clearLCD(); + } +} + /** * Handle MobiFlight Commands * This function shouldn't be called be a user, it should only be called by the @@ -300,8 +310,11 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) // showLandRValue((int16_t)data); deprecated return; else if (messageID == 7) + // setAnnunciatorTest((bool)data); deprecated + return; + else if (messageID == 8) // This one shows the string and checks for 'L' or 'R' as first character showLandRValue(setPoint); - else if (messageID == 8) + else if (messageID == 9) setPowerSave((bool)setPoint); } diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h index 931540e..a90f5b6 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.h @@ -55,4 +55,7 @@ class KAV_A3XX_RUDDER_LCD { void showLandRValue(int16_t value); void showLandRValue(float value); void showLandRValue(char* value); + + // Set Annunciator Test + void setAnnunciatorTest(bool enabled); }; From 91bbf911a0ea48643528ed33d0a3d0459527e632 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:47:07 +0200 Subject: [PATCH 06/13] only changes for Rudder, not for Radio --- .../devices/kav_rad_tcas.device.json | 42 ++++-- KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp | 136 +++++++++++------- KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h | 5 +- 3 files changed, 120 insertions(+), 63 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rad_tcas.device.json b/KAV_Simulation/Community/devices/kav_rad_tcas.device.json index 918b4af..179aee0 100644 --- a/KAV_Simulation/Community/devices/kav_rad_tcas.device.json +++ b/KAV_Simulation/Community/devices/kav_rad_tcas.device.json @@ -5,7 +5,7 @@ "Type": "KAV_RAD_TCAS", "Author": "Jak Kav", "URL": "https://github.com/MobiFlight/MobiFlight-CustomDevices/tree/main/KAV_Simulation/EFIS_FCU", - "Version" : "1.0.0" + "Version": "1.0.0" }, "Config": { "Pins": [ @@ -16,11 +16,35 @@ "isI2C": false }, "MessageTypes": [ - { - "id": 4, - "label": "Set value as string", - "description": "$ is shown as string" - } - ] - } - \ No newline at end of file + { + "id": -1, + "label": "Clear display", + "description": "will clear the display" + }, + { + "id": 0, + "label": "Set dot", + "description": "$ sets the dot to show or hide (0/1)" + }, + { + "id": 1, + "label": "Set pattern", + "description": "$ will show the aircraft 'test' pattern (0/1)" + }, + { + "id": 2, + "label": "Set value radio", + "description": "$ will show the value on the display for radio" + }, + { + "id": 3, + "label": "Set value TCAS", + "description": "$ will show the value on the display for TCAS" + }, + { + "id": 4, + "label": "(v2.5.3+) Annunciator Test Mode", + "description": "$ = 1 will display all Segments, $ = 0 will clear display" + } + ] +} \ No newline at end of file diff --git a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp index 69e2a92..3a2c1c5 100644 --- a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.cpp @@ -1,5 +1,4 @@ #include "KAV_A3XX_RAD_TCAS_LCD.h" -#include "KAV_GetDigitPattern.h" #define DIGIT_ONE 0 #define DIGIT_TWO 1 @@ -69,29 +68,15 @@ void KAV_A3XX_RAD_TCAS_LCD::refreshLCD(uint8_t address) ht_rad_tcas.write(address * 2, buffer[address], 8); } -/** - * Refresh the LCD - * After a change is made to a segment, the display must be refreshed so that - * the change is visible. - * @param address The address to refresh - * @param digits The number of digits to refresh - */ -void KAV_A3XX_RAD_TCAS_LCD::refreshLCD(uint8_t address, uint8_t digits) -{ - for (uint8_t i = 0; i < digits; i++) { - refreshLCD(address + i); - } -} - /** * Clear the LCD * This function clears the LCD and resets the buffer. */ void KAV_A3XX_RAD_TCAS_LCD::clearLCD() { - char bufferDigits[12] = {0}; - snprintf(bufferDigits, 12, " "); - showValue(bufferDigits); + for (uint8_t i = 0; i < ht_rad_tcas.MAX_ADDR; i++) + ht_rad_tcas.write(i, 0); + memset(buffer, 0, BUFFER_SIZE_MAX); } void KAV_A3XX_RAD_TCAS_LCD::clearDigit(uint8_t address) @@ -137,35 +122,48 @@ void KAV_A3XX_RAD_TCAS_LCD::setAllDots(bool enabled) /** * Set the value of the LCD using an integer for radio (6 characters). - * The dots get NOT cleared. If required use showRadio() * @param value The value to display */ void KAV_A3XX_RAD_TCAS_LCD::setRadioValue(uint32_t value) { - char bufferDigits[12] = {0}; if (value == 0) - snprintf(bufferDigits, 12, "000000"); - else - dtostrf((float)value/1000, 6, 3, bufferDigits); - - getDigitPattern(buffer, DIGIT_ONE, bufferDigits, 6); - refreshLCD(DIGIT_ONE, 6); + { + displayDigit(DIGIT_ONE, 11); + displayDigit(DIGIT_TWO, 13); + displayDigit(DIGIT_THREE, 14); + displayDigit(DIGIT_FOUR, 15); + displayDigit(DIGIT_FIVE, 14); + displayDigit(DIGIT_SIX, 11); + } else { + if (value > 999999) + value = 999999; + displayDigit(DIGIT_SIX, (value % 10)); + value = value / 10; + displayDigit(DIGIT_FIVE, (value % 10)); + value = value / 10; + displayDigit(DIGIT_FOUR, (value % 10)); + value = value / 10; + displayDigit(DIGIT_THREE, (value % 10)); + value = value / 10; + displayDigit(DIGIT_TWO, (value % 10)); + displayDigit(DIGIT_ONE, (value / 10)); + } } /** * Set the value of the LCD using an integer for TCAS (4 characters). - * The dots get NOT cleared. If required use showTcas() * @param value The value to display */ void KAV_A3XX_RAD_TCAS_LCD::setTcasValue(uint16_t value) { - char bufferDigits[12] = {0}; if (value > 9999) value = 9999; - - snprintf(bufferDigits, 12, " %04d ", value); - getDigitPattern(buffer, DIGIT_ONE, bufferDigits, 6); - refreshLCD(DIGIT_ONE, 6); + displayDigit(DIGIT_FIVE, (value % 10)); + value = value / 10; + displayDigit(DIGIT_FOUR, (value % 10)); + value = value / 10; + displayDigit(DIGIT_THREE, (value % 10)); + displayDigit(DIGIT_TWO, (value / 10)); } // Show values as a combined function @@ -176,12 +174,11 @@ void KAV_A3XX_RAD_TCAS_LCD::setTcasValue(uint16_t value) */ void KAV_A3XX_RAD_TCAS_LCD::showRadio(uint32_t value) { - char bufferDigits[12] = {0}; + setRadioValue(value); if (value == 0) - snprintf(bufferDigits, 12, "000.000"); + setRadioDot(false); else - dtostrf((float)value/1000, 6, 3, bufferDigits); - showValue(bufferDigits); + setRadioDot(true); } /** @@ -191,11 +188,10 @@ void KAV_A3XX_RAD_TCAS_LCD::showRadio(uint32_t value) */ void KAV_A3XX_RAD_TCAS_LCD::showTcas(uint16_t value) { - char bufferDigits[12] = {0}; - if (value > 9999) - value = 9999; - snprintf(bufferDigits, 12, " %04d ", value); - showValue(bufferDigits); + setTcasValue(value); + displayDigit(DIGIT_ONE, 11); + displayDigit(DIGIT_SIX, 11); + setRadioDot(false); } /** @@ -204,19 +200,57 @@ void KAV_A3XX_RAD_TCAS_LCD::showTcas(uint16_t value) */ void KAV_A3XX_RAD_TCAS_LCD::showTest(bool enabled) { - char bufferDigits[12] = {0}; if (enabled) - snprintf(bufferDigits, 12, "8.8.8.8.8.8"); + { + setRadioValue(888888); + setAllDots(enabled); + } else - snprintf(bufferDigits, 12, " "); - showValue(bufferDigits); + { + clearLCD(); + } } -void KAV_A3XX_RAD_TCAS_LCD::showValue(char* value) { - getDigitPattern(buffer, DIGIT_ONE, value, 6, (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5)); - refreshLCD(DIGIT_ONE, 6); -} +// Global Functions +/** + * A list of the binary patterns to show different characters on the LCD. + */ +uint8_t digitPatternRadTcas[16] = { + 0b11101011, // 0 + 0b01100000, // 1 + 0b11000111, // 2 + 0b11100101, // 3 + 0b01101100, // 4 + 0b10101101, // 5 or S + 0b10101111, // 6 + 0b11100000, // 7 + 0b11101111, // 8 + 0b11101101, // 9 + 0b00000100, // - + 0b00000000, // blank + 0b11001100, // small 0 (For V/S) + // Below are characters for 'dAtA' + 0b01100111, // d + 0b11101110, // A + 0b00001111, // t +}; +/** + * Display a digit on a specific address. + * @param address The address to display the digit on + * @param digit The digit to display + * @see digitPatternRadTcas + */ +void KAV_A3XX_RAD_TCAS_LCD::displayDigit(uint8_t address, uint8_t digit) +{ + // This ensures that anything over 12 is turned to 'blank', and as it's unsigned, anything less than 0 will become 255, and therefore, 'blank'. + if (digit > 15) + digit = 11; + + buffer[address] = digitPatternRadTcas[digit]; + + refreshLCD(address); +} /** * Handle MobiFlight Commands @@ -251,5 +285,5 @@ void KAV_A3XX_RAD_TCAS_LCD::set(int16_t messageID, char *setPoint) else if (messageID == 3) showTcas((uint16_t)data); else if (messageID == 4) - showValue(setPoint); -} + showTest((bool)data); +} \ No newline at end of file diff --git a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h index 7590f67..d618959 100644 --- a/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h +++ b/KAV_Simulation/KAV_A3XX_RAD_TCAS_LCD.h @@ -22,9 +22,9 @@ class KAV_A3XX_RAD_TCAS_LCD { byte _DATA; // Methods + void handleMobiFlightCmd(char *string); void displayDigit(uint8_t address, uint8_t digit); void refreshLCD(uint8_t address); - void refreshLCD(uint8_t address, uint8_t digits); public: // Constructor @@ -46,9 +46,8 @@ class KAV_A3XX_RAD_TCAS_LCD { void setRadioValue(uint32_t value); void setTcasValue(uint16_t value); - // Show Radio Value function + // Show Value function void showRadio(uint32_t value); void showTcas(uint16_t value); void showTest(bool enabled); - void showValue(char* value); }; From 7047c116451e945d6abb59273751881948c306e2 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Tue, 25 Jun 2024 08:35:56 +0200 Subject: [PATCH 07/13] new version, better descriptions --- .../Community/devices/kav_rudder.device.json | 51 ++----------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rudder.device.json b/KAV_Simulation/Community/devices/kav_rudder.device.json index 803597d..f3467c2 100644 --- a/KAV_Simulation/Community/devices/kav_rudder.device.json +++ b/KAV_Simulation/Community/devices/kav_rudder.device.json @@ -5,7 +5,7 @@ "Type": "KAV_RUDDER", "Author": "Jak Kav", "URL": "https://github.com/MobiFlight/MobiFlight-CustomDevices/tree/main/KAV_Simulation/EFIS_FCU", - "Version" : "1.0.0" + "Version" : "1.0.1" }, "Config": { "Pins": [ @@ -16,61 +16,20 @@ "isI2C": false }, "MessageTypes": [ - { - "id": -1, - "label": "Clear display", - "description": "will clear the display" - }, - { - "id": 0, - "label": "Set 'L'", - "description": "$ will set the first character to show 'L' or blank (0/1)" - }, - { - "id": 1, - "label": "Set 'R'", - "description": "$ will set the first character to show 'R' or blank (0/1)" - }, - { - "id": 2, - "label": "Set dot", - "description": "$ will set the dot to show or hide" - }, - { - "id": 3, - "label": "Set value", - "description": "$ will set the value of the LCD" - }, - { - "id": 4, - "label": "Set value w/ 'L'", - "description": "$ will set the value on the display with the 'L' character" - }, - { - "id": 5, - "label": "Set value w/ 'R'", - "description": "$ will set the value of the display with the 'R' character" - }, - { - "id": 6, - "label": "Set value w/ 'L' or 'R'", - "description": "$ will set the value of the display with the 'L' or 'R' character" - }, { "id": 7, "label": "(v2.5.3+) Annunciator Test Mode", - "description": "$ = 1 will display all Segments, $ = 0 will clear display" + "description": "$ = 1 will display all Segments, $ = 0 will restore the display" }, { "id": 8, - "label": "Set value w/ 'L' or 'R'", + "label": "(v2.5.4+) Set value w/ 'L' or 'R'", "description": "$ as string will be displayed with the 'L' or 'R' character, e.g. 'L12.3'" }, { "id": 9, - "label": "Clear or restore LCD", - "description": "1 = Clear LCD, 0 = Show LCD" + "label": "(v2.5.4+) Clear or restore display", + "description": "$ = 1 will clear the display, $ = 0 will restore the display" } ] } - \ No newline at end of file From de3128f4e755ca97a6c846cd56de7fd6fc5a4a3a Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Tue, 25 Jun 2024 08:36:34 +0200 Subject: [PATCH 08/13] re-enable test mode, restore display after test mode --- KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index f14f1dc..67408ec 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -258,7 +258,7 @@ void KAV_A3XX_RUDDER_LCD::setAnnunciatorTest(bool enabled) for (uint8_t i = 0; i < ht_rudder.MAX_ADDR; i++) ht_rudder.write(i, 0xFF); } else { - clearLCD(); + setPowerSave(false); } } @@ -310,7 +310,7 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) // showLandRValue((int16_t)data); deprecated return; else if (messageID == 7) - // setAnnunciatorTest((bool)data); deprecated + setAnnunciatorTest((bool)data); deprecated return; else if (messageID == 8) // This one shows the string and checks for 'L' or 'R' as first character From 8bc991520ed740825ba9a5bb11f72442c203b690 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Tue, 25 Jun 2024 08:57:33 +0200 Subject: [PATCH 09/13] fixed not evaluating messageID's > 7 --- KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index 67408ec..1695579 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -311,7 +311,6 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) return; else if (messageID == 7) setAnnunciatorTest((bool)data); deprecated - return; else if (messageID == 8) // This one shows the string and checks for 'L' or 'R' as first character showLandRValue(setPoint); From e8bdb717c934cc85e54adeab4d0658d1bc4d437d Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:47:19 +0200 Subject: [PATCH 10/13] not complete comment deleted --- KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index 1695579..6f963bb 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -310,7 +310,7 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) // showLandRValue((int16_t)data); deprecated return; else if (messageID == 7) - setAnnunciatorTest((bool)data); deprecated + setAnnunciatorTest((bool)data); else if (messageID == 8) // This one shows the string and checks for 'L' or 'R' as first character showLandRValue(setPoint); From 81e45a0ac45db44117bdc3879b5cd8bbafb651fd Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:04:57 +0200 Subject: [PATCH 11/13] fixed wrong data type for setPowerSave --- KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index 6f963bb..a03c590 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -243,11 +243,10 @@ void KAV_A3XX_RUDDER_LCD::showLandRValue(char *value) void KAV_A3XX_RUDDER_LCD::setPowerSave(bool enabled) { - if (enabled) { + if (enabled) clearLCD(); - } else { + else showLandRValue(_lastRudderValue); - } } // Global Functions @@ -286,7 +285,7 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) if (messageID == -1) setPowerSave(true); else if (messageID == -2) - setPowerSave((bool)setPoint); + setPowerSave((bool)data); else if (messageID == 0) // setLeft((uint16_t)data); deprecated return; @@ -301,7 +300,8 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) // setValue((int16_t)data); deprecated return; else if (messageID == 4) - showLeftValue((uint16_t)data); + // showLeftValue((uint16_t)data); deprecated + return; else if (messageID == 5) // showRightValue((uint16_t)data); deprecated return; @@ -315,5 +315,5 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) // This one shows the string and checks for 'L' or 'R' as first character showLandRValue(setPoint); else if (messageID == 9) - setPowerSave((bool)setPoint); + setPowerSave((bool)data); } From f0e70b5691008805c325851e30bcf7ccba63da51 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:41:45 +0200 Subject: [PATCH 12/13] keep backwards compatibility, keep "old" messageID's --- .../Community/devices/kav_rudder.device.json | 35 +++++++++++++++++++ KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp | 21 ++++------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/KAV_Simulation/Community/devices/kav_rudder.device.json b/KAV_Simulation/Community/devices/kav_rudder.device.json index f3467c2..ef3ddd8 100644 --- a/KAV_Simulation/Community/devices/kav_rudder.device.json +++ b/KAV_Simulation/Community/devices/kav_rudder.device.json @@ -16,6 +16,41 @@ "isI2C": false }, "MessageTypes": [ + { + "id": 0, + "label": "(deprecated) Set 'L'", + "description": "$ will set the first character to show 'L' or blank (0/1)" + }, + { + "id": 1, + "label": "(deprecated) Set 'R'", + "description": "$ will set the first character to show 'R' or blank (0/1)" + }, + { + "id": 2, + "label": "(deprecated) Set dot", + "description": "$ will set the dot to show or hide" + }, + { + "id": 3, + "label": "(deprecated) Set value", + "description": "$ will set the value of the LCD" + }, + { + "id": 4, + "label": "(deprecated) Set value w/ 'L'", + "description": "$ will set the value on the display with the 'L' character" + }, + { + "id": 5, + "label": "(deprecated) Set value w/ 'R'", + "description": "$ will set the value of the display with the 'R' character" + }, + { + "id": 6, + "label": "(deprecated) Set value w/ 'L' or 'R'", + "description": "$ will set the value of the display with the 'L' or 'R' character" + }, { "id": 7, "label": "(v2.5.3+) Annunciator Test Mode", diff --git a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp index a03c590..8f94d81 100644 --- a/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp +++ b/KAV_Simulation/KAV_A3XX_RUDDER_LCD.cpp @@ -287,28 +287,21 @@ void KAV_A3XX_RUDDER_LCD::set(int16_t messageID, char *setPoint) else if (messageID == -2) setPowerSave((bool)data); else if (messageID == 0) - // setLeft((uint16_t)data); deprecated - return; + setLeft((uint16_t)data); // deprecated else if (messageID == 1) - // setRight((uint16_t)data); deprecated - return; + setRight((uint16_t)data); // deprecated else if (messageID == 2) - // setDot((uint16_t)data); deprecated - return; + setDot((uint16_t)data); // deprecated else if (messageID == 3) // This one needs to keep it's sign, so using `int16_t`. - // setValue((int16_t)data); deprecated - return; + setValue((int16_t)data); // deprecated else if (messageID == 4) - // showLeftValue((uint16_t)data); deprecated - return; + showLeftValue((uint16_t)data); // deprecated else if (messageID == 5) - // showRightValue((uint16_t)data); deprecated - return; + showRightValue((uint16_t)data); // deprecated else if (messageID == 6) // This one needs to keep it's sign, so using `int16_t`. - // showLandRValue((int16_t)data); deprecated - return; + showLandRValue((int16_t)data); // deprecated else if (messageID == 7) setAnnunciatorTest((bool)data); else if (messageID == 8) From 669aa75acaacf097c10cd80e53bdf4e757d94c03 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:36:39 +0200 Subject: [PATCH 13/13] example config for string support for FBWA320 --- .../Rudder String support FBWA320.mcc | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 KAV_Simulation/Community/profiles/msfs2020/Rudder String support FBWA320.mcc diff --git a/KAV_Simulation/Community/profiles/msfs2020/Rudder String support FBWA320.mcc b/KAV_Simulation/Community/profiles/msfs2020/Rudder String support FBWA320.mcc new file mode 100644 index 0000000..78be159 --- /dev/null +++ b/KAV_Simulation/Community/profiles/msfs2020/Rudder String support FBWA320.mcc @@ -0,0 +1,36 @@ + + + + + true + Rudder Trim value + + + + + + + + + + + true + Rudder Trim + + + + + + + + + + + + + + + + + + \ No newline at end of file