Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/minimize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ local mspRcTuningReplacements = {
{ ".yaw_dynamic_ceiling_gain", "[28]" },
{ ".yaw_dynamic_deadband_gain", "[29]" },
{ ".yaw_dynamic_deadband_filter", "[30]" },
{ ".cyclic_ring", "[31]" },
}

local mspPidTuningReplacements = {
Expand Down
33 changes: 33 additions & 0 deletions src/SCRIPTS/RF2/F/language.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local function loadTranslations(l)
local file = "LANG/" .. l .. ".lua"
local chunk, err = rf2.loadScript(file)
if not chunk then
-- It's normal for a language file not to exist, so we don't log an error.
-- The fallback mechanism will handle it.
return nil
end
local ok, result = pcall(chunk)
if not ok then
return nil
end
return result
end

---
-- Loads the translation file for the current system language.
-- It falls back to English ('en') if the system language file is not found,
-- and then to an empty table if English is also not found.
-- @return table The translations table.
local function getTranslations()
local settings = getGeneralSettings()
local lang = settings.language
local translations = loadTranslations(lang) or loadTranslations("en") or {}

function translations.t(key)
return translations[key] or key
end

return translations
end

return getTranslations()
Binary file added src/SCRIPTS/RF2/IMG/acc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/esc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/fblstatus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/filters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/flrtr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/governor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/hobbywing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/mainrotor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/mixer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/msp_exp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/pids-bandwidth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/pids-controller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/pids.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/rates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/rescue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/rfstatus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/scorpion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/servos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/xdfly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/SCRIPTS/RF2/IMG/yge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions src/SCRIPTS/RF2/LANG/de.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
-- Language file for German (de)
return {
TITLE_Menu_Menu = "Hauptmenü",
TITLE_WARNING_Save = "Speichern Warnung",
MSG_WARNING_Save_later = "Einstellungen werden nach dem Entsichern gespeichert.",
TITLE_Save_Error = "Speichern Fehler",
MSG_Save_Error = "Stellen Sie sicher, dass Ihr Heli entsichert ist.",
MENU_Save = "\xEF\x80\x99 Speichern",
MENU_Reload = "\xEF\x80\xA1 Neu laden",
MENU_Reboot = "\xEF\x81\xB9 Neustart",
PAGE_Status = "Status",
PAGE_Rates = "Drehraten",
PAGE_Rate_Dynamics = "Drehraten Adv.",
PAGE_PID_Gains = "PIDs",
PAGE_PID_Controller = "PID Regler",
PAGE_Profile_Various = "Profil - versch.",
PAGE_Profile_Rescue = "Profil - Rettung",
PAGE_Profile_Governor = "Drehzahlregler",
PAGE_Servos = "Servos",
PAGE_Mixer = "Mischer",
PAGE_Gyro_Filters = "Gyro Filter",
PAGE_Governor = "Drehzahlregler",
PAGE_Accelerometer_Trim = "ACC Trimm",
PAGE_Model = "Modell",
PAGE_Experimental = "Experimentell (!)",
PAGE_ESC_FLYROTOR = "ESC - FLYROTOR",
PAGE_ESC_HW_Platinum_V5 = "ESC - HW Platinum V5",
PAGE_ESC_Scorpion_Tribunus = "ESC - Scorpion Tribunus",
PAGE_ESC_XDFly = "ESC - XDFly",
PAGE_ESC_YGE = "ESC - YGE",
PAGE_Settings = "Einstellungen",
PAGE_Status_PID_Profile = "Aktuelles PID Profil",
PAGE_Status_Rate_Profile = "Aktuelles Raten Profil",
PAGE_Status_Real_Time_Load = "Echtzeit Last",
PAGE_Status_CPU_Load = "CPU Last",
PAGE_Status_Arming_Flags = "Arming Sperrgründe",
PAGE_Status_Dataflash_Free = "Dataflash freier Speicher",
PAGE_Status_Erase = "[Löschen]",
MSG_Erasing = "Lösche...",
ARMING_DISABLED_NO_GYRO = "Kein Gyro",
ARMING_DISABLED_FAIL_SAFE = "Failsafe",
ARMING_DISABLED_RX_FAIL_SAFE = "RX Failsafe",
ARMING_DISABLED_BAD_RX_RECOVERY = "Schlechte RX Erholung",
ARMING_DISABLED_BOX_FAIL_SAFE = "Box Failsafe",
ARMING_DISABLED_GOVERNOR = "Drehzahlregler",
ARMING_DISABLED_RPM_SIGNAL = "RPM Signal",
ARMING_DISABLED_THROTTLE = "Gas",
ARMING_DISABLED_ANGLE = "Winkel",
ARMING_DISABLED_BOOT_GRACE_TIME = "Boot Wartezeit",
ARMING_DISABLED_NO_PRE_ARM = "Kein Pre-Arm",
ARMING_DISABLED_LOAD = "Systemlast",
ARMING_DISABLED_CALIBRATING = "Kalibrierung",
ARMING_DISABLED_CLI = "CLI",
ARMING_DISABLED_CMS_MENU = "CMS Menü",
ARMING_DISABLED_BST = "BST",
ARMING_DISABLED_MSP = "MSP",
ARMING_DISABLED_PARALYZE = "Paralyze",
ARMING_DISABLED_GPS = "GPS",
ARMING_DISABLED_RESC = "Rettung",
ARMING_DISABLED_RPM_FILTER = "RPM Filter",
ARMING_DISABLED_REBOOT_REQUIRED = "Neustart erforderlich",
ARMING_DISABLED_DSHOT_BITBANG = "DSHOT Bitbang",
ARMING_DISABLED_ACC_CALIBRATION = "ACC Kalibrierung",
ARMING_DISABLED_MOTOR_PROTOCOL = "Motor Protokoll",
ARMING_DISABLED_ARM_SWITCH = "Arm Schalter",
ACC_Title = "Beschleunigungssensor",
ACC_Label = "Beschleunigungssensor Trimm",
ACC_Roll = "Roll",
ACC_Pitch = "Nick",
ACC_Calibrate = "Kalibrieren",
ACC_Calibrating = "Kalibriere...",
ACC_Help_title = "Beschleunigungssensor",
ACC_Help_text = "Der Beschleunigungssensor wird verwendet, um den Winkel des Flugcontrollers in Bezug auf den Horizont zu messen. Diese Daten werden zur Stabilisierung des Fluggeraets und zur Bereitstellung der Selbstnivellierungsfunktion verwendet.",
ACC_Calibration_Question = "Beschleunigungssensor kalibrieren?\nStellen Sie sicher, dass das Fluggerät auf einer ebenen Oberfläche platziert ist und während des Kalibrierungsprozesses ruhig bleibt.",
MENU_Yes = "Ja",
MENU_No = "Nein",
STATUS_Help_title = "Status",
STATUS_Help_text = "Diese Seite zeigt den aktuellen Status des Flugcontrollers an, einschließlich PID- und Ratenprofile, Systemlast und Arming-Sperrgründe.",
RATES_Help_title = "Drehraten",
RATES_Help_text = "Diese Seite ermöglicht es Ihnen, die Raten und Expos für Ihren Hubschrauber zu konfigurieren. Sie können Roll-, Nick-, Gier- und Kollektivraten sowie deren entsprechende Exponentialwerte anpassen.",
RATES_ADVANCE_Help_title = "Drehraten - Erweitert",
RATES_ADVANCE_Help_text = "Dynamik: Wird unabhaengig vom Rate-Typ angewendet. Anpassen, um Heli-Bewegungen weicher zu machen, z. B. fuer Scale-Helis.",
MENU_Dest_Profile = "Ziel Profil",
MENU_Copy_Profile = "[Kopiere Akt. nach Ziel]",
Rates_Yaw = "Gier",
Rates_Coll = "Kollektiv",
Rates_Type = "Raten Typ",
Model_ID = "Modell ID",
Model_Stats = "Statistiken",
Model_Stats_Enabled = "Aktiviert",
Model_Total_Flights = "Anzahl Flüge",
Model_Total_Time = "Gesamtzeit",
Model_Total_Dist = "Gesamtdistanz",
Model_Min_Armed_Time = "Min. Armed Zeit",
Model_Reset_Stats = "[Statistiken zurücksetzen]",
Model_Radio_Config = "Funk Konfiguration",
Model_Requires_Rf2bg = "Hinweis: benötigt rf2bg",
Model_Set_Name_Tx = "Name auf Sender setzen",
Model_Param = "Param",
Model_Type = "Typ",
Model_Value = "Wert",
}
102 changes: 102 additions & 0 deletions src/SCRIPTS/RF2/LANG/en.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
-- Language file for english (en)
return {
TITLE_Menu_Menu = "Main Menu",
TITLE_WARNING_Save = "Save warning",
MSG_WARNING_Save_later = "Settings will be saved\nafter disarming.",
TITLE_Save_Error = "Save error",
MSG_Save_Error = "Make sure your heli\nis disarmed.",
MENU_Save = "\xEF\x80\x99 Save",
MENU_Reload = "\xEF\x80\xA1 Reload",
MENU_Reboot = "\xEF\x81\xB9 Reboot",
PAGE_Status = "Status",
PAGE_Rates = "Rates",
PAGE_Rate_Dynamics = "Rate Adv.",
PAGE_PID_Gains = "PIDs",
PAGE_PID_Controller = "PID Controller",
PAGE_Profile_Various = "Profile-Various",
PAGE_Profile_Rescue = "Profile - Rescue",
PAGE_Profile_Governor = "Governor",
PAGE_Servos = "Servos",
PAGE_Mixer = "Mixer",
PAGE_Gyro_Filters = "Gyro Filters",
PAGE_Governor = "Governor",
PAGE_Accelerometer_Trim = "ACC Trim",
PAGE_Model = "Model",
PAGE_Experimental = "Experimental (!)",
PAGE_ESC_FLYROTOR = "ESC - FLYROTOR",
PAGE_ESC_HW_Platinum_V5 = "ESC - HW Platinum V5",
PAGE_ESC_Scorpion_Tribunus = "ESC - Scorpion Tribunus",
PAGE_ESC_XDFly = "ESC - XDFly",
PAGE_ESC_YGE = "ESC - YGE",
PAGE_Settings = "Settings",
PAGE_Status_PID_Profile = "Current PID profile",
PAGE_Status_Rate_Profile = "Current rate profile",
PAGE_Status_Real_Time_Load = "Real-time load",
PAGE_Status_CPU_Load = "CPU load",
PAGE_Status_Arming_Flags = "Arming Disabled Flags",
PAGE_Status_Dataflash_Free = "Dataflash Free Space",
PAGE_Status_Erase = "[Erase]",
MSG_Erasing = "Erasing...",
ARMING_DISABLED_NO_GYRO = "No Gyro",
ARMING_DISABLED_FAIL_SAFE = "Fail Safe",
ARMING_DISABLED_RX_FAIL_SAFE = "RX Fail Safe",
ARMING_DISABLED_BAD_RX_RECOVERY = "Bad RX Recovery",
ARMING_DISABLED_BOX_FAIL_SAFE = "Box Fail Safe",
ARMING_DISABLED_GOVERNOR = "Governor",
ARMING_DISABLED_RPM_SIGNAL = "RPM Signal",
ARMING_DISABLED_THROTTLE = "Throttle",
ARMING_DISABLED_ANGLE = "Angle",
ARMING_DISABLED_BOOT_GRACE_TIME = "Boot Grace Time",
ARMING_DISABLED_NO_PRE_ARM = "No Pre Arm",
ARMING_DISABLED_LOAD = "Load",
ARMING_DISABLED_CALIBRATING = "Calibrating",
ARMING_DISABLED_CLI = "CLI",
ARMING_DISABLED_CMS_MENU = "CMS Menu",
ARMING_DISABLED_BST = "BST",
ARMING_DISABLED_MSP = "MSP",
ARMING_DISABLED_PARALYZE = "Paralyze",
ARMING_DISABLED_GPS = "GPS",
ARMING_DISABLED_RESC = "Resc",
ARMING_DISABLED_RPM_FILTER = "RPM Filter",
ARMING_DISABLED_REBOOT_REQUIRED = "Reboot Required",
ARMING_DISABLED_DSHOT_BITBANG = "DSHOT Bitbang",
ARMING_DISABLED_ACC_CALIBRATION = "Acc Calibration",
ARMING_DISABLED_MOTOR_PROTOCOL = "Motor Protocol",
ARMING_DISABLED_ARM_SWITCH = "Arm Switch",
ACC_Title = "Accelerometer",
ACC_Label = "Accelerometer Trim",
ACC_Roll = "Roll",
ACC_Pitch = "Pitch",
ACC_Calibrate = "Calibrate",
ACC_Calibrating = "Calibrating...",
ACC_Help_title = "Accelerometer",
ACC_Help_text = "The accelerometer is used to measure the angle of the flight controller in relation to the horizon. This data is used to stabilize the aircraft and provide self-leveling functionality.",
ACC_Calibration_Question = "Calibrate the accelerometer?\nMake sure the aircraft is placed on a level surface and will remain stationary during the calibration process.",
MENU_Yes = "Yes",
MENU_No = "No",
STATUS_Help_title = "Status",
STATUS_Help_text = "This page shows the current status of the flight controller, including PID and rate profiles, system load and arming disabled flags.",
RATES_Help_title = "Rates",
RATES_Help_text = "This page allows you to configure the rates and expos for your helicopter. You can adjust roll, pitch, yaw, and collective rates as well as their corresponding",
RATES_ADVANCE_Help_title = "Rates - Advanced",
RATES_ADVANCE_Help_text = "Dynamics: Applied regardless of rates type. Typically left on defaults but can be adjusted to smooth heli movements, like with scale helis.",
MENU_Dest_Profile = "Destination profile",
MENU_Copy_Profile = "[Copy Current to Dest]",
Rates_Yaw = "Yaw",
Rates_Coll = "Coll",
Rates_Type = "Rates type",
Model_ID = "Model ID",
Model_Stats = "Statistics",
Model_Stats_Enabled = "Enabled",
Model_Total_Flights = "Total flights",
Model_Total_Time = "Total time",
Model_Total_Dist = "Total distance",
Model_Min_Armed_Time = "Min armed time",
Model_Reset_Stats = "[Reset Stats]",
Model_Radio_Config = "Radio Configuration",
Model_Requires_Rf2bg = "Note: requires rf2bg",
Model_Set_Name_Tx = "Set name on TX",
Model_Param = "Param",
Model_Type = "type",
Model_Value = "value",
}
92 changes: 75 additions & 17 deletions src/SCRIPTS/RF2/LVGL/mainMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,97 @@ local function show(menu)
local w = (LCD_W - 30) / 3
local h = 50

-- --- FINE TUNING ---
local OFFSET_X = -6 -- Horizontal fits perfectly
local OFFSET_Y = 8 -- Correction to move text down

for i = 1, #menu.items do
local item = menu.items[i]

-- 1. Container Box
local content_box = {
type = "box",
w = w,
h = h,

x = OFFSET_X,
y = OFFSET_Y,

-- Center content
flexFlow = lvgl.FLOW_ROW,
flexAlignMain = lvgl.FLEX_ALIGN_CENTER,
flexAlignCross = lvgl.FLEX_ALIGN_CENTER,
flexGap = 5,

children = {}
}

-- 2. Fill content into the box
if item.icon and item.icon ~= "" then
if string.find(item.icon, ".png") then
-- >>> IMAGE ICON (.png) <<<
content_box.children[#content_box.children + 1] = {
type = "image",
file = item.icon,
w = 16,
h = 16
}
-- Text next to it
content_box.children[#content_box.children + 1] = {
type = "label",
text = item.text,
color = lcd.RGB(255, 255, 255)
}
else
-- >>> SYMBOL ICON (FontAwesome) <<<
content_box.children[#content_box.children + 1] = {
type = "label",
text = item.icon .. " " .. item.text,
color = lcd.RGB(255, 255, 255) -- White
}
end
else
-- >>> NO ICON (Text Only) <<<
content_box.children[#content_box.children + 1] = {
type = "label",
text = item.text,
color = lcd.RGB(255, 255, 255) -- White
}
end

-- 3. CREATE BUTTON
children[#children + 1] = {
type = "button",
x = 6 + #children % 3 * (w + 4),
y = 6 + math.floor(#children / 3) * (h + 4),
w = w,
h = h,
text = item.text,
color = lcd.RGB(48, 48, 48), -- Dark Gray
press = function()
if item.click then
item.click(i)
end
end
end,
children = {content_box}
}
end

local lyt = {
{
type = "page",
title = menu.title,
subtitle = menu.subtitle,
icon = rf2.baseDir .. "rf2.png",
back = function()
if menu.back then
menu.back()
end
end,
children = children
},
}
local lyt = {{
type = "page",
title = menu.title,
subtitle = menu.subtitle,
icon = rf2.baseDir .. "rf2.png",
back = function()
if menu.back then
menu.back()
end
end,
children = children
}}

lvgl.build(lyt)
end

return { show = show }
return {
show = show
}
Loading