summaryrefslogtreecommitdiffstats
path: root/applications/luci-app-lorawan-basicstation/htdocs/luci-static/resources/view/lorawan-basicstation/advanced.js
blob: d436c20e81d9617ed23d173235ea6882219ae93b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
'use strict';
'require form';
'require view';
'require uci';

return view.extend({
	load() {
		return Promise.all([
			uci.load('basicstation')
		]);
	},

	render() {
		let m, s, o, options;
		
		/* Advanced Settings */
		m = new form.Map('basicstation', _('Advanced Settings'));

		/* RF Configuration */
		s = m.section(form.GridSection, 'rfconf', _('RF Configuration'));
		s.addremove = true;
		s.anonymous = false;
		s.nodescriptions = true;

		o = s.option(form.ListValue, 'type', _('Type'), 
			_('RF front end type'));
		o.value('SX1250');
		o.default = 'SX1250';

		o = s.option(form.Flag, 'txEnable', _('Tx enable'),
			_('Enable transmission capabilities'));
		o.default = 'false';

		o = s.option(form.Value, 'freq', _('Frequency'),
			_('Frequency in Hz'));
		o.datatype = 'uinteger';

		o = s.option(form.Value, 'antennaGain', _('Antenna Gain'),
			_('Antenna gain in dBi'));
		o.datatype = 'uinteger';
		
		o = s.option(form.Value, 'rssiOffset', _('RSSI Offset'),
			_('RSSI offset in dBm'));
		o.datatype = 'float';
		
		o = s.option(form.ListValue, 'useRssiTcomp', _('RSSI Tcomp'),
			_('RSSI Tcomp object to be used for this RF configuration'));
		options = uci.sections('basicstation', 'rssitcomp')
		for (let opt of options) {
			o.value(opt['.name']);
		}
		o.default = 'std';

		/* RSSI Tcomp */
		s = m.section(form.GridSection, 'rssitcomp', _('RSSI Tcomp'));
		s.addremove = true;
		s.anonymous = false;
		s.nodescripitons = true;

		o = s.option(form.Value, 'coeff_a', _('Coeff A'));
		o.datatype = 'float';
		
		o = s.option(form.Value, 'coeff_b', _('Coeff B'));
		o.datatype = 'float';
		
		o = s.option(form.Value, 'coeff_c', _('Coeff C'));
		o.datatype = 'float';
		
		o = s.option(form.Value, 'coeff_d', _('Coeff D'));
		o.datatype = 'float';
		
		o = s.option(form.Value, 'coeff_e', _('Coeff E'));
		o.datatype = 'float';

		/* TX Gain Lookup Table */
		s = m.section(form.GridSection, 'txlut', _('TX Gain Lookup Table'));
		s.addremove = true;
		s.anonymous = true;
		s.nodescriptions = true;

		o = s.option(form.Value, 'rfPower', _('RF Power'),
			_('RF output power target in dBm'));
		o.datatype = 'uinteger';
		
		o = s.option(form.Flag, 'paGain', _('PA Enable'),
			_('Power amplifier enabled'));
		o.default = false;
		
		o = s.option(form.Value, 'pwrIdx', _('Power Index'),
			_('Possible gain settings from 0 (min. gain) to 22 (max. gain)'));
		o.datatype = 'range(0,22)';

		o = s.option(form.DynamicList, 'usedBy', _('Used By'),
			_('RF configurations that use this tx gain object'));
		options = uci.sections('basicstation', 'rfconf');
		for (let opt of options) {
			o.value(opt['.name']);
		}

		return m.render();
	},
});