Skip to content

Commit 4d63c86

Browse files
committed
commit
1 parent d965698 commit 4d63c86

File tree

5 files changed

+129
-122
lines changed

5 files changed

+129
-122
lines changed

locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@
398398
"nornCraftName": {
399399
"message": "Craft Name"
400400
},
401+
"nornMBId": {
402+
"message": "MB ID"
403+
},
401404
"nornGPS": {
402405
"message": "GPS"
403406
},

src/js/tabs/norn_config.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@ Handlebars.registerHelper("eq", function (a, b) {
1111
return a === b;
1212
});
1313

14+
Handlebars.registerHelper("ne", function (a, b) {
15+
return a !== b;
16+
});
17+
18+
Handlebars.registerHelper("and", function (a, b) {
19+
return a && b;
20+
});
21+
22+
Handlebars.registerHelper("or", function (a, b) {
23+
return a || b;
24+
});
25+
26+
Handlebars.registerHelper("not", function (a) {
27+
return !a;
28+
});
29+
30+
Handlebars.registerHelper("elseif", function (condition, options) {
31+
if (condition) {
32+
return options.fn(this);
33+
}
34+
return options.inverse(this);
35+
});
36+
1437
// Discover config sources (text-based)
1538
const templateFiles = import.meta.glob("../../norn-configs/template.hbs", { eager: true, as: "raw" });
1639

@@ -107,6 +130,12 @@ norn_config.initialize = function (callback) {
107130
craftNameInput.on("input", function () {
108131
self.analyticsChanges["NornCraftName"] = $(this).val() || null;
109132
});
133+
134+
// MB ID input wiring
135+
const mbIdInput = $("#norn_mb_id");
136+
mbIdInput.on("input", function () {
137+
self.analyticsChanges["NornMBId"] = $(this).val() || null;
138+
});
110139
}
111140

112141
function on_tab_loaded_handler() {
@@ -143,7 +172,8 @@ norn_config.initialize = function (callback) {
143172
const vtxKey = $("select[name='norn_vtx']").val() || "";
144173
const gpsEnabled = $("#norn_gps").is(":checked");
145174
const craftName = $("#norn_craft_name").val() || "";
146-
return { fcKey, droneSize, manticoreKey, vtxKey, gpsEnabled, craftName };
175+
const mbId = $("#norn_mb_id").val() || "";
176+
return { fcKey, droneSize, manticoreKey, vtxKey, gpsEnabled, craftName, mbId };
147177
}
148178

149179
function on_generate_handler(e) {
@@ -198,13 +228,15 @@ norn_config.initialize = function (callback) {
198228
const vtxKey = $("select[name='norn_vtx']").val();
199229
const gpsEnabled = $("#norn_gps").is(":checked");
200230
const craftName = $("#norn_craft_name").val();
231+
const mbId = $("#norn_mb_id").val();
201232

202233
if (fcKey) parts.push(fcKey);
203234
if (droneSize) parts.push(`${droneSize}inch`);
204235
if (manticoreKey) parts.push(manticoreKey);
205236
if (vtxKey) parts.push(vtxKey);
206237
if (gpsEnabled) parts.push("GPS");
207238
if (craftName) parts.push(craftName);
239+
if (mbId) parts.push(`MB${mbId}`);
208240

209241
const filename = parts.length > 0 ? `norn_config_${parts.join("_")}.txt` : "norn_config.txt";
210242

src/norn-configs/README.txt

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
#
77
# fcKey: Flight Controller type (from select[name='norn_fc'])
88
# - '': Empty/None selected
9-
# - 'f4': FLASHHOBBYF405 (F4 chip)
10-
# - 'f7': SPEEDYBEEF405V3 (F7 chip)
11-
# - 'h7': TAKERF722SE or GEPRCF722 (H7 chip) - Note: both use same value
9+
# - 'FLASHHOBBYF405': FLASHHOBBYF405 (F4 chip)
10+
# - 'SPEEDYBEEF405V3': SPEEDYBEEF405V3 (F7 chip)
11+
# - 'TAKERF722SE': TAKERF722SE (H7 chip)
12+
# - 'GEPRCF722': GEPRCF722 (H7 chip)
1213
#
1314
# droneSize: Drone frame size in inches (from select[name='norn_drone_size'])
1415
# - '': Empty/None selected
@@ -21,14 +22,14 @@
2122
#
2223
# manticoreKey: Manticore system configuration (from select[name='norn_manticore'])
2324
# - '': Empty/None selected
24-
# - 'uart': UART-based Manticore setup
25-
# - 'gpio': GPIO-based Manticore setup
25+
# - 'UART': UART-based Manticore setup
26+
# - 'GPIO': GPIO-based Manticore setup
2627
#
2728
# vtxKey: Video Transmitter configuration (from select[name='norn_vtx'])
2829
# - '': Empty/None selected
29-
# - '3.3_vtx': 3.3GHz VTX setup
30-
# - '5.8_vtx': 5.8GHz VTX setup
31-
# - 'optica': Optica VTX setup
30+
# - '3.3VTX': 3.3GHz VTX setup
31+
# - '5.8VTX': 5.8GHz VTX setup
32+
# - 'OPTICA': Optica VTX setup
3233
#
3334
# gpsEnabled: Boolean flag for GPS functionality (from #norn_gps checkbox)
3435
# - true: Enable GPS features
@@ -38,20 +39,26 @@
3839
# - '': Empty string if no name entered
3940
# - Any string value for craft identification
4041
#
41-
# Template Syntax:
42-
# - <% if (condition) { %> ... <% } %> : Conditional blocks
43-
# - <%= variable %> : Output variable value
44-
# - <%# comment %> : Template comments (not included in output)
42+
# mbId: MB ID identifier (from #norn_mb_id input)
43+
# - '': Empty string if no MB ID entered
44+
# - Any string value for MB identification
45+
#
46+
# Template Syntax (Handlebars):
47+
# - {{#if condition}} ... {{/if}} : Conditional blocks
48+
# - {{variable}} : Output variable value
49+
# - {{!-- comment --}} : Template comments (not included in output)
50+
# - {{#if (eq variable 'value')}} : Equality comparison with helper
4551
#
4652
# Example usage in conditional blocks:
47-
# <% if (fcKey === 'f4') { %>
48-
# # This section applies only to F4 flight controllers
49-
# <% } %>
53+
# {{#if (eq fcKey 'FLASHHOBBYF405')}}
54+
# # This section applies only to FLASHHOBBYF405 flight controllers
55+
# {{/if}}
5056
#
51-
# <% if (droneSize === '7') { %>
52-
# # This section applies only to 7-inch drones
53-
# <% } %>
57+
# {{#if droneSize}}
58+
# # This section applies only when drone size is selected
59+
# {{/if}}
5460
#
5561
# Note: All select elements have an empty option for "None" selection
5662
# Checkbox elements return boolean values (true/false)
57-
# Input elements return string values (may be empty string)
63+
# Input elements return string values (may be empty string)
64+
# The 'eq' helper is registered for equality comparisons in Handlebars

src/norn-configs/template.hbs

Lines changed: 49 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,64 @@
1-
{{#if fcKey}}# FC: {{fcKey}}
2-
{{/if}}{{#if droneSize}}# Drone Size: {{droneSize}}
3-
{{/if}}{{#if manticoreKey}}# Manticore: {{manticoreKey}}
4-
{{/if}}{{#if vtxKey}}# VTX: {{vtxKey}}
5-
{{/if}}{{#if gpsEnabled}}# GPS: {{gpsEnabled}}
6-
{{/if}}{{#if craftName}}# Craft Name: {{craftName}}
7-
{{/if}}
1+
# FC: {{fcKey}}
2+
# Drone Size: {{droneSize}}
3+
# Manticore: {{manticoreKey}}
4+
# Video: {{vtxKey}}
5+
# GPS: {{gpsEnabled}}
6+
# Craft Name: {{craftName}}
7+
# MB ID: {{mbId}}
88

99
defaults nosave
10-
1110
batch start
12-
1311
defaults nosave
1412

15-
{{!-- Flight Controller Configuration Blocks --}}
16-
{{#if (eq fcKey 'FLASHHOBBYF405')}}
17-
set pid_process_denom = 2
18-
{{/if}}
19-
20-
{{#if (eq fcKey 'SPEEDYBEEF405V3')}}
21-
set pid_process_denom = 1
22-
{{/if}}
23-
24-
{{#if (eq fcKey 'TAKERF722SE')}}
25-
set pid_process_denom = 1
26-
set cpu_overclock = ON
13+
{{!-- GPIO Configuration --}}
14+
{{#if (eq manticoreKey 'GPIO')}}
15+
# RESOURCES CONFIGURATION
16+
{{!-- FLASHHOBBYF405 specific GPIO resources --}}
17+
{{#if (eq fcKey 'FLASHHOBBYF405')}}
18+
resource PINIO 1 A01
19+
resource PINIO 2 A00
20+
{{/if}}
21+
{{!-- TAKERF722SE specific GPIO resources --}}
22+
{{#if (eq fcKey 'TAKERF722SE')}}
23+
resource PINIO 1 A03
24+
resource PINIO 3 A02
25+
{{/if}}
26+
{{!-- Common GPIO configuration for ALL GPIO setups --}}
27+
set pinio_config = 1,1,1,1
28+
set pinio_box = 58,255,59,255
2729
{{/if}}
2830

29-
{{#if (eq fcKey 'GEPRCF722')}}
30-
set pid_process_denom = 1
31-
set cpu_overclock = ON
31+
# FEATURES CONFIGURATION
32+
{{!-- Common features for all configurations --}}
33+
feature TELEMETRY
34+
feature OSD
35+
{{!-- GPS feature --}}
36+
{{#if gpsEnabled}}
37+
feature GPS
3238
{{/if}}
3339

34-
{{!-- Drone Size Configuration Block --}}
35-
{{!-- Motor settings optimized for different frame sizes --}}
36-
{{#if droneSize}}
37-
# Drone Size: {{droneSize}}"
38-
{{#if (eq droneSize '7')}}
39-
set motor_pwm_rate = 32000
40-
set motor_poles = 12
41-
{{/if}}
42-
{{#if (eq droneSize '8')}}
43-
set motor_pwm_rate = 24000
44-
set motor_poles = 14
45-
{{/if}}
46-
{{#if (eq droneSize '9')}}
47-
set motor_pwm_rate = 24000
48-
set motor_poles = 16
49-
{{/if}}
50-
{{#if (eq droneSize '10')}}
51-
set motor_pwm_rate = 16000
52-
set motor_poles = 18
53-
{{/if}}
54-
{{#if (eq droneSize '13')}}
55-
set motor_pwm_rate = 12000
56-
set motor_poles = 20
40+
# PORTS CONFIGURATION
41+
{{#if (ne vtxKey 'OPTICA')}}
42+
serial UART1 8192 115200 57600 0 115200
5743
{{/if}}
58-
{{#if (eq droneSize '15')}}
59-
set motor_pwm_rate = 8000
60-
set motor_poles = 22
61-
{{/if}}
62-
{{/if}}
63-
64-
{{!-- Manticore System Configuration Blocks --}}
44+
{{!-- Manticore UART Configuration --}}
6545
{{#if (eq manticoreKey 'UART')}}
66-
# Manticore UART variant
67-
# Configure UART ports for Manticore communication
68-
set uart1_function = RX_SERIAL
69-
set uart2_function = TELEMETRY
46+
{{#if (eq fcKey 'FLASHHOBBYF405')}}
47+
serial UART4 4194304 115200 57600 0 115200
48+
{{else}}
49+
serial UART2 4194304 115200 57600 0 115200
50+
{{/if}}
7051
{{/if}}
71-
52+
{{!-- Manticore GPIO Configuration --}}
7253
{{#if (eq manticoreKey 'GPIO')}}
73-
# Manticore GPIO variant
74-
# Configure GPIO pins for Manticore interface
75-
set gpio_output = ON
76-
set gpio_mode = ALTERNATE
77-
{{/if}}
78-
79-
{{!-- Video Transmitter (VTX) Configuration Blocks --}}
80-
{{#if (eq vtxKey '5.8VTX')}}
81-
# 5.8GHz VTX settings
82-
# Standard 5.8GHz video transmitter configuration
83-
set vtx_band = A
84-
set vtx_channel = 1
85-
set vtx_power = 25
86-
{{/if}}
87-
88-
{{#if (eq vtxKey '3.3VTX')}}
89-
# 3.3GHz VTX settings
90-
# Long-range 3.3GHz video transmitter configuration
91-
set vtx_band = B
92-
set vtx_channel = 3
93-
set vtx_power = 100
94-
{{/if}}
95-
96-
{{#if (eq vtxKey 'OPTICA')}}
97-
# Optica VTX settings
98-
# Digital video transmitter configuration
99-
set vtx_band = O
100-
set vtx_channel = 2
101-
set vtx_power = 50
102-
{{/if}}
103-
104-
{{!-- GPS Configuration Block --}}
54+
{{#if (eq fcKey 'FLASHHOBBYF405')}}
55+
serial UART4 2097152 115200 57600 0 115200
56+
{{else}}
57+
serial UART2 2097152 115200 57600 0 115200
58+
{{/if}}
59+
{{/if}}
60+
serial UART5 64 115200 57600 0 115200
61+
{{!-- GPS Configuration --}}
10562
{{#if gpsEnabled}}
106-
# GPS Enabled
107-
# Enable GPS functionality with auto baudrate detection
108-
feature GPS
109-
set gps_baudrate = AUTO
63+
serial UART6 2 115200 57600 0 115200
11064
{{/if}}
111-
112-
{{!-- Custom Craft Name Configuration Block --}}
113-
{{#if craftName}}
114-
# Craft name
115-
# Set custom identification name for the craft
116-
set craft_name = {{craftName}}
117-
{{/if}}

src/tabs/norn_config.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@
9999
</div>
100100
</div>
101101

102+
<div class="grid-row grid-box col2">
103+
<div class="col-span-1">
104+
<div class="gui_box grey">
105+
<div class="gui_box_titlebar">
106+
<div class="spacer_box_title" i18n="nornMBId"></div>
107+
</div>
108+
<div class="spacer_box">
109+
<div class="select">
110+
<input type="text" id="norn_mb_id" placeholder="Enter MB ID" style="width: 100%;" />
111+
</div>
112+
</div>
113+
</div>
114+
</div>
115+
<div class="col-span-1">
116+
<!-- Empty space for future use -->
117+
</div>
118+
</div>
119+
102120
<div class="buttons" style="margin-top: 16px;">
103121
<a href="#" class="generate regular-button" i18n="nornGenerate"></a>
104122
</div>

0 commit comments

Comments
 (0)