poe-svelte-ui-lib 2.14.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,89 @@
1
+ /* $lib/WidgetLoRa/lora.ts - параметры LoRa для WidgetLoRa: где лежит каждый параметр в прошивке (ключ группы, биты слова, масштаб, таблица кодов), шаблоны драйверов, чтение и сборка слов. Без Svelte - проверяется тестами против dist */
2
+ import { bitFieldGet, bitFieldSet } from "../bitField.js";
3
+ /* Параметры радио, общие для микросхем LoRa (SX126x, SX127x, LLCC68, STM32WL) */
4
+ export const LORA_PARAMS = ["Freq", "TxP", "BW", "SF", "CR", "Preamble", "CRC", "InvIQ"];
5
+ /* Переключатели: код 0 или 1 */
6
+ export const LORA_SWITCHES = ["CRC", "InvIQ"];
7
+ const opts = (pairs) => pairs.map(([name, value]) => ({ name, value }));
8
+ const SF_NAMES = (from, codeFrom, count) => opts(Array.from({ length: count }, (_, i) => [String(from + i), codeFrom + i]));
9
+ /* Шаблоны драйверов: заполняют params разом, дальше любое поле правится в конструкторе */
10
+ export const LORA_PRESETS = {
11
+ /* Общее слово LORA.Cfg: драйвер HT_CT62 ProdFactory-ESP и lora_service ProdFactory-STM (STM32WL) */
12
+ HT_CT62: {
13
+ name: "HT-CT62 / STM32WL",
14
+ params: {
15
+ Freq: { key: "Cfg", bits: { start: 21, end: 30 }, min: 150, max: 960, step: 1 },
16
+ TxP: { key: "Cfg", bits: { start: 2, end: 6 }, min: 0, max: 22, step: 1 },
17
+ BW: {
18
+ key: "Cfg",
19
+ bits: { start: 7, end: 10 },
20
+ options: opts([
21
+ ["125", 4],
22
+ ["250", 5],
23
+ ["500", 6],
24
+ ]),
25
+ },
26
+ SF: { key: "Cfg", bits: { start: 11, end: 13 }, options: SF_NAMES(7, 2, 6) },
27
+ CR: {
28
+ key: "Cfg",
29
+ bits: { start: 14, end: 15 },
30
+ options: opts([
31
+ ["4/5", 0],
32
+ ["4/6", 1],
33
+ ["4/7", 2],
34
+ ["4/8", 3],
35
+ ]),
36
+ },
37
+ Preamble: {
38
+ key: "Cfg",
39
+ bits: { start: 18, end: 20 },
40
+ options: opts([
41
+ ["6", 0],
42
+ ["8", 1],
43
+ ["10", 2],
44
+ ["12", 3],
45
+ ["16", 4],
46
+ ["20", 5],
47
+ ["24", 6],
48
+ ["32", 7],
49
+ ]),
50
+ },
51
+ CRC: { key: "Cfg", bits: { start: 16, end: 16 } },
52
+ InvIQ: { key: "Cfg", bits: { start: 17, end: 17 } },
53
+ },
54
+ },
55
+ };
56
+ /* Ключи группы, которые нужны параметрам, без повторов */
57
+ export const loraKeys = (params) => [...new Set(Object.values(params).flatMap((p) => (p?.key ? [p.key] : [])))];
58
+ /* Код параметра из значений ключей устройства; нет значения ключа - undefined */
59
+ const readCode = (raw, p) => {
60
+ const word = Number(raw[p.key]);
61
+ if (raw[p.key] === undefined || raw[p.key] === null || !Number.isFinite(word))
62
+ return undefined;
63
+ return p.bits ? bitFieldGet(word, p.bits.start, p.bits.end) : word;
64
+ };
65
+ /* Значения для показа из значений ключей устройства */
66
+ export const loraDecode = (params, raw) => {
67
+ const values = {};
68
+ for (const name of LORA_PARAMS) {
69
+ const p = params[name];
70
+ const code = p ? readCode(raw, p) : undefined;
71
+ if (p && code !== undefined)
72
+ values[name] = p.options || LORA_SWITCHES.includes(name) ? code : (code - (p.offset ?? 0)) / (p.scale || 1);
73
+ }
74
+ return values;
75
+ };
76
+ /* Значения ключей для SET: параметры пишутся в свои биты поверх текущих слов, остальные биты слова не меняются */
77
+ export const loraEncode = (params, raw, values) => {
78
+ const out = {};
79
+ for (const name of LORA_PARAMS) {
80
+ const p = params[name];
81
+ const value = values[name];
82
+ if (!p?.key || value === undefined || !Number.isFinite(value))
83
+ continue;
84
+ const code = p.options || LORA_SWITCHES.includes(name) ? Math.trunc(value) : Math.round(value * (p.scale || 1)) + (p.offset ?? 0);
85
+ const word = out[p.key] ?? (Number(raw[p.key]) || 0);
86
+ out[p.key] = p.bits ? bitFieldSet(word, p.bits.start, p.bits.end, code) : code;
87
+ }
88
+ return out;
89
+ };
@@ -20,6 +20,7 @@ import VideoViewerProps from "./VideoViewer/VideoViewerProps.svelte";
20
20
  import WidgetProps from "./Widget/WidgetProps.svelte";
21
21
  import WidgetWiFiProps from "./WidgetWiFi/WidgetWiFiProps.svelte";
22
22
  import WidgetDeviceInfoProps from "./WidgetDeviceInfo/WidgetDeviceInfoProps.svelte";
23
+ import WidgetLoRaProps from "./WidgetLoRa/WidgetLoRaProps.svelte";
23
24
  import WidgetFileSystemProps from "./WidgetFileSystem/WidgetFileSystemProps.svelte";
24
25
  import WidgetStackInfoProps from "./WidgetStackInfo/WidgetStackInfoProps.svelte";
25
26
  import WidgetRGBStripProps from "./WidgetRGBStrip/WidgetRGBStripProps.svelte";
@@ -30,6 +31,6 @@ export { optionsStore } from "./options";
30
31
  export { createPropsEditor, applyPropertyChange, type PropertyChange } from "./propsEditor";
31
32
  export { default as CommonSnippets } from "./CommonSnippets.svelte";
32
33
  export { COMPONENT_DEFAULTS, COMPONENT_SIZES, minComponentWidth, createComponent } from "./defaults";
33
- export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
34
+ export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetLoRaProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
34
35
  export declare const PANELS: Record<UIType, Component<any>>;
35
36
  export { default as TextsEditor } from "./TextsEditor.svelte";
@@ -20,6 +20,7 @@ import VideoViewerProps from "./VideoViewer/VideoViewerProps.svelte";
20
20
  import WidgetProps from "./Widget/WidgetProps.svelte";
21
21
  import WidgetWiFiProps from "./WidgetWiFi/WidgetWiFiProps.svelte";
22
22
  import WidgetDeviceInfoProps from "./WidgetDeviceInfo/WidgetDeviceInfoProps.svelte";
23
+ import WidgetLoRaProps from "./WidgetLoRa/WidgetLoRaProps.svelte";
23
24
  import WidgetFileSystemProps from "./WidgetFileSystem/WidgetFileSystemProps.svelte";
24
25
  import WidgetStackInfoProps from "./WidgetStackInfo/WidgetStackInfoProps.svelte";
25
26
  import WidgetRGBStripProps from "./WidgetRGBStrip/WidgetRGBStripProps.svelte";
@@ -31,7 +32,7 @@ export { optionsStore } from "./options";
31
32
  export { createPropsEditor, applyPropertyChange } from "./propsEditor";
32
33
  export { default as CommonSnippets } from "./CommonSnippets.svelte";
33
34
  export { COMPONENT_DEFAULTS, COMPONENT_SIZES, minComponentWidth, createComponent } from "./defaults";
34
- export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
35
+ export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetLoRaProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
35
36
  /* Панель свойств по типу: <Panel component={c} onPropertyChange={...} /> вместо ветвления по типам */
36
37
  export const PANELS = {
37
38
  Accordion: AccordionProps,
@@ -53,6 +54,7 @@ export const PANELS = {
53
54
  Widget: WidgetProps,
54
55
  WidgetWiFi: WidgetWiFiProps,
55
56
  WidgetDeviceInfo: WidgetDeviceInfoProps,
57
+ WidgetLoRa: WidgetLoRaProps,
56
58
  WidgetFileSystem: WidgetFileSystemProps,
57
59
  WidgetStackInfo: WidgetStackInfoProps,
58
60
  WidgetRGBStrip: WidgetRGBStripProps,
package/dist/defaults.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* $lib/defaults.ts - новые компоненты конструктора: свойства и размер по умолчанию, создание компонента. Тексты пустые - задаются в «Тексты и переводы», заголовок смарт-виджета - его название на всех языках */
2
2
  import { GUI_GRID, isWidgetType } from "./gui";
3
3
  import { widgetTitle } from "./locales/i18n";
4
+ import { LORA_PRESETS } from "./WidgetLoRa/lora";
4
5
  const label = { name: "", class: "text-center" };
5
6
  /* Новый виджет на холсте свёрнут: холст не растягивается, автор раскрывает нужный */
6
7
  const widget = (type) => ({ label: { name: widgetTitle(type) }, collapsed: true });
@@ -8,6 +9,7 @@ const widget = (type) => ({ label: { name: widgetTitle(type) }, collapsed: true
8
9
  export const COMPONENT_DEFAULTS = {
9
10
  WidgetWiFi: { ...widget("WidgetWiFi"), id: "CFG", allowedModes: [1, 2, 3], confirmOnAP: true },
10
11
  WidgetDeviceInfo: { ...widget("WidgetDeviceInfo"), id: "CFG" },
12
+ WidgetLoRa: { ...widget("WidgetLoRa"), id: "LORA", preset: "HT_CT62", params: structuredClone(LORA_PRESETS.HT_CT62.params) },
11
13
  WidgetFileSystem: { ...widget("WidgetFileSystem"), id: "CFG", accept: "*/*", maxNameLength: 31 },
12
14
  WidgetStackInfo: { ...widget("WidgetStackInfo"), warnBytes: 512, period: 0 },
13
15
  WidgetRGBStrip: { ...widget("WidgetRGBStrip"), id: "LST" },
@@ -71,6 +73,7 @@ export const COMPONENT_DEFAULTS = {
71
73
  export const COMPONENT_SIZES = {
72
74
  WidgetWiFi: { width: 7, height: 1 },
73
75
  WidgetDeviceInfo: { width: 7, height: 1 },
76
+ WidgetLoRa: { width: 7, height: 1 },
74
77
  WidgetFileSystem: { width: 7, height: 1 },
75
78
  WidgetStackInfo: { width: 7, height: 1 },
76
79
  WidgetRGBStrip: { width: 7, height: 1 },
@@ -28,6 +28,7 @@ components:
28
28
  # Смарт-виджеты
29
29
  - [WidgetWiFi, widget] # настройки Wi-Fi
30
30
  - [WidgetDeviceInfo, widget] # об устройстве
31
+ - [WidgetLoRa, widget] # настройки радио LoRa
31
32
  - [WidgetFileSystem, widget] # файлы устройства
32
33
  - [WidgetStackInfo, widget] # задачи и память
33
34
  - [WidgetRGBStrip, widget] # светодиодная лента
@@ -1,4 +1,4 @@
1
- export declare const COMPONENT_TYPES: readonly ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
1
+ export declare const COMPONENT_TYPES: readonly ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetLoRa", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
2
2
  export declare const COMPONENT_IO: {
3
3
  readonly Accordion: "none";
4
4
  readonly Tabs: "none";
@@ -19,6 +19,7 @@ export declare const COMPONENT_IO: {
19
19
  readonly VideoViewer: "none";
20
20
  readonly WidgetWiFi: "widget";
21
21
  readonly WidgetDeviceInfo: "widget";
22
+ readonly WidgetLoRa: "widget";
22
23
  readonly WidgetFileSystem: "widget";
23
24
  readonly WidgetStackInfo: "widget";
24
25
  readonly WidgetRGBStrip: "widget";
@@ -1,5 +1,5 @@
1
1
  /* $lib/dictionaries/generated/components.ts - СГЕНЕРИРОВАНО из components.yaml (npm run Generate), руками не править */
2
- export const COMPONENT_TYPES = ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
2
+ export const COMPONENT_TYPES = ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetLoRa", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
3
3
  export const COMPONENT_IO = {
4
4
  Accordion: "none",
5
5
  Tabs: "none",
@@ -20,6 +20,7 @@ export const COMPONENT_IO = {
20
20
  VideoViewer: "none",
21
21
  WidgetWiFi: "widget",
22
22
  WidgetDeviceInfo: "widget",
23
+ WidgetLoRa: "widget",
23
24
  WidgetFileSystem: "widget",
24
25
  WidgetStackInfo: "widget",
25
26
  WidgetRGBStrip: "widget",
@@ -17,6 +17,7 @@ import VideoViewer from "./VideoViewer/VideoViewer.svelte";
17
17
  import Widget from "./Widget/Widget.svelte";
18
18
  import WidgetWiFi from "./WidgetWiFi/WidgetWiFi.svelte";
19
19
  import WidgetDeviceInfo from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
20
+ import WidgetLoRa from "./WidgetLoRa/WidgetLoRa.svelte";
20
21
  import WidgetFileSystem from "./WidgetFileSystem/WidgetFileSystem.svelte";
21
22
  import WidgetStackInfo from "./WidgetStackInfo/WidgetStackInfo.svelte";
22
23
  import WidgetRGBStrip from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -42,6 +43,7 @@ export interface GuiViewsAll {
42
43
  Widget: typeof Widget;
43
44
  WidgetWiFi: typeof WidgetWiFi;
44
45
  WidgetDeviceInfo: typeof WidgetDeviceInfo;
46
+ WidgetLoRa: typeof WidgetLoRa;
45
47
  WidgetFileSystem: typeof WidgetFileSystem;
46
48
  WidgetStackInfo: typeof WidgetStackInfo;
47
49
  WidgetRGBStrip: typeof WidgetRGBStrip;
package/dist/guiViews.js CHANGED
@@ -17,6 +17,7 @@ import VideoViewer from "./VideoViewer/VideoViewer.svelte";
17
17
  import Widget from "./Widget/Widget.svelte";
18
18
  import WidgetWiFi from "./WidgetWiFi/WidgetWiFi.svelte";
19
19
  import WidgetDeviceInfo from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
20
+ import WidgetLoRa from "./WidgetLoRa/WidgetLoRa.svelte";
20
21
  import WidgetFileSystem from "./WidgetFileSystem/WidgetFileSystem.svelte";
21
22
  import WidgetStackInfo from "./WidgetStackInfo/WidgetStackInfo.svelte";
22
23
  import WidgetRGBStrip from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -43,6 +44,7 @@ export const GUI_VIEWS = {
43
44
  Widget,
44
45
  WidgetWiFi,
45
46
  WidgetDeviceInfo,
47
+ WidgetLoRa,
46
48
  WidgetFileSystem,
47
49
  WidgetStackInfo,
48
50
  WidgetRGBStrip,
package/dist/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export { default as VideoViewer } from "./VideoViewer/VideoViewer.svelte";
29
29
  export { default as Widget } from "./Widget/Widget.svelte";
30
30
  export { default as WidgetWiFi } from "./WidgetWiFi/WidgetWiFi.svelte";
31
31
  export { default as WidgetDeviceInfo } from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
32
+ export { default as WidgetLoRa } from "./WidgetLoRa/WidgetLoRa.svelte";
33
+ export { LORA_PARAMS, LORA_PRESETS, loraDecode, loraEncode, loraKeys } from "./WidgetLoRa/lora";
32
34
  export { default as WidgetFileSystem } from "./WidgetFileSystem/WidgetFileSystem.svelte";
33
35
  export { default as WidgetStackInfo } from "./WidgetStackInfo/WidgetStackInfo.svelte";
34
36
  export { default as WidgetRGBStrip } from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -68,5 +70,5 @@ export { default as IconGripVerticalRight } from "./libIcons/IconGripVerticalRig
68
70
  export { escapeHtml, htmlToText, sanitizeHtml } from "./html";
69
71
  export { hintsSetting, hint, type HintParams } from "./hints";
70
72
  export { applyDragGhost, clearDragGhost, createDropPlaceholder } from "./dragStyle";
71
- export { type UIComponent, type UIComponentPropsMap, type UIType, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type IOption, type SelectValue, type IconSource, type ISwitchProps, type IDividerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IWidgetProps, type IWidgetWiFiProps, type IWidgetWiFiConfig, type IWidgetDeviceInfoProps, type IWidgetDeviceInfoConfig, type IWidgetFileSystemProps, type IWidgetFileSystemInfo, type IWidgetFileSystemFile, type IWidgetFileSystemUpload, type IWidgetStackInfoProps, type IWidgetStackInfo, type IWidgetStackInfoHeap, type IWidgetStackInfoTask, type IWidgetRGBStripProps, type IWidgetRGBStripConfig, type IWidgetPFDProps, type IWidgetPFDData, type IWidgetPFDLimits, type IWidgetMapProps, type IWidgetMapData, type IGraphProps, type IGraphDataObject, type IGraphHistoryPoint, type IGraphHistorySeries, type ITableHeader, type ITableText, type ITableSelect, type ITableButton, type ITableMenu, type ITableProgressBar, type ITableImage, type ITableContent, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type FileAttachValue, type IDropdownProps, type IDropdownItem, type IDropdownTriggerProps, type ICarouselProps, type IReceivingDataObject, type IVideoViewerProps, type IPeriodChartProps, type IPeriodChartLevel, } from "./types";
73
+ export { type UIComponent, type UIComponentPropsMap, type UIType, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type IOption, type SelectValue, type IconSource, type ISwitchProps, type IDividerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IWidgetProps, type IWidgetWiFiProps, type IWidgetWiFiConfig, type IWidgetDeviceInfoProps, type IWidgetDeviceInfoConfig, type IWidgetLoRaProps, type LoRaParams, type ILoRaParamConfig, type IWidgetFileSystemProps, type IWidgetFileSystemInfo, type IWidgetFileSystemFile, type IWidgetFileSystemUpload, type IWidgetStackInfoProps, type IWidgetStackInfo, type IWidgetStackInfoHeap, type IWidgetStackInfoTask, type IWidgetRGBStripProps, type IWidgetRGBStripConfig, type IWidgetPFDProps, type IWidgetPFDData, type IWidgetPFDLimits, type IWidgetMapProps, type IWidgetMapData, type IGraphProps, type IGraphDataObject, type IGraphHistoryPoint, type IGraphHistorySeries, type ITableHeader, type ITableText, type ITableSelect, type ITableButton, type ITableMenu, type ITableProgressBar, type ITableImage, type ITableContent, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type FileAttachValue, type IDropdownProps, type IDropdownItem, type IDropdownTriggerProps, type ICarouselProps, type IReceivingDataObject, type IVideoViewerProps, type IPeriodChartProps, type IPeriodChartLevel, } from "./types";
72
74
  export { ICONS, ICON_NAMES, ICONS_ARRAY } from "./icons";
package/dist/index.js CHANGED
@@ -30,6 +30,8 @@ export { default as VideoViewer } from "./VideoViewer/VideoViewer.svelte";
30
30
  export { default as Widget } from "./Widget/Widget.svelte";
31
31
  export { default as WidgetWiFi } from "./WidgetWiFi/WidgetWiFi.svelte";
32
32
  export { default as WidgetDeviceInfo } from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
33
+ export { default as WidgetLoRa } from "./WidgetLoRa/WidgetLoRa.svelte";
34
+ export { LORA_PARAMS, LORA_PRESETS, loraDecode, loraEncode, loraKeys } from "./WidgetLoRa/lora";
33
35
  export { default as WidgetFileSystem } from "./WidgetFileSystem/WidgetFileSystem.svelte";
34
36
  export { default as WidgetStackInfo } from "./WidgetStackInfo/WidgetStackInfo.svelte";
35
37
  export { default as WidgetRGBStrip } from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -1129,6 +1129,21 @@ declare const constructorTranslations: {
1129
1129
  en: string;
1130
1130
  zh: string;
1131
1131
  };
1132
+ "constructor.props.table.hideIf.key": {
1133
+ ru: string;
1134
+ en: string;
1135
+ zh: string;
1136
+ };
1137
+ "constructor.props.table.hideIf.value": {
1138
+ ru: string;
1139
+ en: string;
1140
+ zh: string;
1141
+ };
1142
+ "constructor.props.table.hideIf.info": {
1143
+ ru: string;
1144
+ en: string;
1145
+ zh: string;
1146
+ };
1132
1147
  "constructor.props.table.keys.info": {
1133
1148
  ru: string;
1134
1149
  en: string;
@@ -363,6 +363,13 @@ const constructorTranslations = {
363
363
  "constructor.props.table.columns.image.width": { ru: "Ширина иконки, rem", en: "Icon width, rem", zh: "图标宽度,rem" },
364
364
  "constructor.props.table.columns.image.height": { ru: "Высота иконки, rem", en: "Icon height, rem", zh: "图标高度,rem" },
365
365
  "constructor.props.table.keys": { ru: "Перечень ключей", en: "List of keys", zh: "键列表" },
366
+ "constructor.props.table.hideIf.key": { ru: "Скрыть, если ключ", en: "Hide if key", zh: "隐藏条件键" },
367
+ "constructor.props.table.hideIf.value": { ru: "равен", en: "equals", zh: "等于" },
368
+ "constructor.props.table.hideIf.info": {
369
+ ru: "Кнопка не показывается в строке, где значение этого ключа равно заданному. Пусто - кнопка во всех строках",
370
+ en: "The button is hidden in rows where this key equals the given value. Empty - the button is in every row",
371
+ zh: "当该键的值等于给定值时,该行不显示按钮。为空 - 所有行都显示按钮",
372
+ },
366
373
  "constructor.props.table.keys.info": {
367
374
  ru: "Ключи колонок, значения которых будут возвращаться. Перечислить через пробел",
368
375
  en: "Column keys whose values will be returned. List them separated by spaces",
@@ -58,6 +58,7 @@ export const extendTranslations = (dictionary) => void Object.assign(translation
58
58
  const WIDGET_TITLE_KEYS = {
59
59
  WidgetWiFi: "widget.wifi.title",
60
60
  WidgetDeviceInfo: "widget.info.title",
61
+ WidgetLoRa: "widget.lora.title",
61
62
  WidgetFileSystem: "widget.fs.title",
62
63
  WidgetStackInfo: "widget.stack.title",
63
64
  WidgetRGBStrip: "widget.rgb.title",
@@ -759,6 +759,186 @@ declare const translations: {
759
759
  en: string;
760
760
  zh: string;
761
761
  };
762
+ "widget.lora.title": {
763
+ ru: string;
764
+ en: string;
765
+ zh: string;
766
+ };
767
+ "widget.lora.empty": {
768
+ ru: string;
769
+ en: string;
770
+ zh: string;
771
+ };
772
+ "widget.lora.unsaved": {
773
+ ru: string;
774
+ en: string;
775
+ zh: string;
776
+ };
777
+ "widget.lora.Freq": {
778
+ ru: string;
779
+ en: string;
780
+ zh: string;
781
+ };
782
+ "widget.lora.TxP": {
783
+ ru: string;
784
+ en: string;
785
+ zh: string;
786
+ };
787
+ "widget.lora.BW": {
788
+ ru: string;
789
+ en: string;
790
+ zh: string;
791
+ };
792
+ "widget.lora.SF": {
793
+ ru: string;
794
+ en: string;
795
+ zh: string;
796
+ };
797
+ "widget.lora.CR": {
798
+ ru: string;
799
+ en: string;
800
+ zh: string;
801
+ };
802
+ "widget.lora.Preamble": {
803
+ ru: string;
804
+ en: string;
805
+ zh: string;
806
+ };
807
+ "widget.lora.CRC": {
808
+ ru: string;
809
+ en: string;
810
+ zh: string;
811
+ };
812
+ "widget.lora.InvIQ": {
813
+ ru: string;
814
+ en: string;
815
+ zh: string;
816
+ };
817
+ "widget.lora.hint.Freq": {
818
+ ru: string;
819
+ en: string;
820
+ zh: string;
821
+ };
822
+ "widget.lora.hint.TxP": {
823
+ ru: string;
824
+ en: string;
825
+ zh: string;
826
+ };
827
+ "widget.lora.hint.BW": {
828
+ ru: string;
829
+ en: string;
830
+ zh: string;
831
+ };
832
+ "widget.lora.hint.SF": {
833
+ ru: string;
834
+ en: string;
835
+ zh: string;
836
+ };
837
+ "widget.lora.hint.CR": {
838
+ ru: string;
839
+ en: string;
840
+ zh: string;
841
+ };
842
+ "widget.lora.hint.Preamble": {
843
+ ru: string;
844
+ en: string;
845
+ zh: string;
846
+ };
847
+ "widget.lora.hint.CRC": {
848
+ ru: string;
849
+ en: string;
850
+ zh: string;
851
+ };
852
+ "widget.lora.hint.InvIQ": {
853
+ ru: string;
854
+ en: string;
855
+ zh: string;
856
+ };
857
+ "widget.lora.props.params": {
858
+ ru: string;
859
+ en: string;
860
+ zh: string;
861
+ };
862
+ "widget.lora.props.preset": {
863
+ ru: string;
864
+ en: string;
865
+ zh: string;
866
+ };
867
+ "widget.lora.props.list": {
868
+ ru: string;
869
+ en: string;
870
+ zh: string;
871
+ };
872
+ "widget.lora.props.list.info": {
873
+ ru: string;
874
+ en: string;
875
+ zh: string;
876
+ };
877
+ "widget.lora.props.key": {
878
+ ru: string;
879
+ en: string;
880
+ zh: string;
881
+ };
882
+ "widget.lora.props.bits": {
883
+ ru: string;
884
+ en: string;
885
+ zh: string;
886
+ };
887
+ "widget.lora.props.bits.info": {
888
+ ru: string;
889
+ en: string;
890
+ zh: string;
891
+ };
892
+ "widget.lora.props.variants": {
893
+ ru: string;
894
+ en: string;
895
+ zh: string;
896
+ };
897
+ "widget.lora.props.bit": {
898
+ ru: string;
899
+ en: string;
900
+ zh: string;
901
+ };
902
+ "widget.lora.props.bit_range": {
903
+ ru: string;
904
+ en: string;
905
+ zh: string;
906
+ };
907
+ "widget.lora.props.options": {
908
+ ru: string;
909
+ en: string;
910
+ zh: string;
911
+ };
912
+ "widget.lora.props.options.info": {
913
+ ru: string;
914
+ en: string;
915
+ zh: string;
916
+ };
917
+ "widget.lora.props.scale": {
918
+ ru: string;
919
+ en: string;
920
+ zh: string;
921
+ };
922
+ "widget.lora.props.offset": {
923
+ ru: string;
924
+ en: string;
925
+ zh: string;
926
+ };
927
+ "widget.lora.props.min": {
928
+ ru: string;
929
+ en: string;
930
+ zh: string;
931
+ };
932
+ "widget.lora.props.max": {
933
+ ru: string;
934
+ en: string;
935
+ zh: string;
936
+ };
937
+ "widget.lora.props.step": {
938
+ ru: string;
939
+ en: string;
940
+ zh: string;
941
+ };
762
942
  "widget.rgb.title": {
763
943
  ru: string;
764
944
  en: string;
@@ -336,6 +336,82 @@ const translations = {
336
336
  "widget.fs.downloading": { ru: "Скачивание: {name}", en: "Downloading: {name}", zh: "正在下载:{name}" },
337
337
  "widget.fs.download_failed": { ru: "Скачивание прервано: {error}", en: "Download aborted: {error}", zh: "下载中断:{error}" },
338
338
  "widget.fs.delete_confirm": { ru: "Удалить файл?", en: "Delete file?", zh: "删除文件?" },
339
+ "widget.lora.title": { ru: "Настройки LoRa", en: "LoRa settings", zh: "LoRa 设置" },
340
+ "widget.lora.empty": {
341
+ ru: "Параметры не выбраны: задайте их в конструкторе",
342
+ en: "No parameters selected: set them in the constructor",
343
+ zh: "未选择参数:请在构造器中设置",
344
+ },
345
+ "widget.lora.unsaved": {
346
+ ru: "Не сохранено. У базы и модулей радио должно быть настроено одинаково, иначе связь пропадёт",
347
+ en: "Not saved. The hub and modules must use the same radio settings, otherwise the link is lost",
348
+ zh: "未保存。基站和模块的无线设置必须一致,否则会断开连接",
349
+ },
350
+ "widget.lora.Freq": { ru: "Частота, МГц", en: "Frequency, MHz", zh: "频率, MHz" },
351
+ "widget.lora.TxP": { ru: "Мощность, дБм", en: "Power, dBm", zh: "功率, dBm" },
352
+ "widget.lora.BW": { ru: "Полоса, кГц", en: "Bandwidth, kHz", zh: "带宽, kHz" },
353
+ "widget.lora.SF": { ru: "Спред-фактор", en: "Spreading factor", zh: "扩频因子" },
354
+ "widget.lora.CR": { ru: "Скорость кодирования", en: "Coding rate", zh: "编码率" },
355
+ "widget.lora.Preamble": { ru: "Преамбула, символов", en: "Preamble, symbols", zh: "前导码, 符号" },
356
+ "widget.lora.CRC": { ru: "CRC", en: "CRC", zh: "CRC" },
357
+ "widget.lora.InvIQ": { ru: "Инверсия IQ", en: "IQ inversion", zh: "IQ 反转" },
358
+ "widget.lora.hint.Freq": { ru: "Несущая частота радио", en: "Radio carrier frequency", zh: "无线载波频率" },
359
+ "widget.lora.hint.TxP": {
360
+ ru: "Мощность передатчика: больше - дальше связь и выше расход",
361
+ en: "Transmitter power: higher means longer range and more consumption",
362
+ zh: "发射功率:越高距离越远、功耗越大",
363
+ },
364
+ "widget.lora.hint.BW": {
365
+ ru: "Полоса сигнала: уже - дальше связь, но медленнее",
366
+ en: "Signal bandwidth: narrower means longer range but slower",
367
+ zh: "信号带宽:越窄距离越远但速度越慢",
368
+ },
369
+ "widget.lora.hint.SF": {
370
+ ru: "Больше - дальше связь, но дольше каждый пакет в эфире",
371
+ en: "Higher means longer range but longer airtime per packet",
372
+ zh: "越大距离越远,但每包空中时间越长",
373
+ },
374
+ "widget.lora.hint.CR": {
375
+ ru: "Избыточность для исправления ошибок: 4/8 надёжнее, 4/5 быстрее",
376
+ en: "Error correction redundancy: 4/8 is more robust, 4/5 is faster",
377
+ zh: "纠错冗余:4/8 更可靠,4/5 更快",
378
+ },
379
+ "widget.lora.hint.Preamble": { ru: "Длина вступления перед пакетом", en: "Length of the preamble before a packet", zh: "数据包前导码长度" },
380
+ "widget.lora.hint.CRC": { ru: "Проверка целостности пакета", en: "Packet integrity check", zh: "数据包完整性校验" },
381
+ "widget.lora.hint.InvIQ": {
382
+ ru: "Инверсия IQ: нужна, когда так настроена другая сторона",
383
+ en: "IQ inversion: needed when the other side uses it",
384
+ zh: "IQ 反转:对方启用时需要",
385
+ },
386
+ "widget.lora.props.params": { ru: "Параметры радио", en: "Radio parameters", zh: "无线参数" },
387
+ "widget.lora.props.preset": { ru: "Шаблон драйвера", en: "Driver template", zh: "驱动模板" },
388
+ "widget.lora.props.list": { ru: "Параметр и его место в прошивке", en: "Parameter and its firmware location", zh: "参数及其在固件中的位置" },
389
+ "widget.lora.props.list.info": {
390
+ ru: "Галочка - показывать параметр. Ключ - имя в группе (Cfg, Freq), биты - где поле лежит в слове (пусто - значение ключа целиком). Число в прошивке = значение * масштаб + смещение. Таблица кодов делает параметр списком",
391
+ en: "Checkbox - show the parameter. Key - name in the group (Cfg, Freq), bits - where the field lies in the word (empty - the whole key value). Firmware number = value * scale + offset. A code table turns the parameter into a list",
392
+ zh: "复选框 - 显示参数。键 - 组内名称(Cfg、Freq),位 - 字段在字中的位置(为空 - 整个键值)。固件数值 = 值 * 比例 + 偏移。代码表使参数成为列表",
393
+ },
394
+ "widget.lora.props.key": { ru: "Ключ", en: "Key", zh: "键" },
395
+ "widget.lora.props.bits": { ru: "Биты слова", en: "Word bits", zh: "字中的位" },
396
+ "widget.lora.props.bits.info": {
397
+ ru: "Включено - параметр лежит в битах слова ключа, выключено - значение ключа целиком",
398
+ en: "On - the parameter lies in bits of the key word, off - the whole key value",
399
+ zh: "开启 - 参数位于键字的位中,关闭 - 整个键值",
400
+ },
401
+ "widget.lora.props.variants": { ru: "вариантов", en: "options", zh: "选项" },
402
+ "widget.lora.props.bit": { ru: "Бит", en: "Bit", zh: "位" },
403
+ "widget.lora.props.bit_range": { ru: "Биты", en: "Bits", zh: "位" },
404
+ "widget.lora.props.options": { ru: "Таблица кодов", en: "Code table", zh: "代码表" },
405
+ "widget.lora.props.options.info": {
406
+ ru: "Пары имя=код через пробел, например 125=4 250=5 500=6. Пусто - параметр вводится числом",
407
+ en: "Pairs name=code separated by spaces, e.g. 125=4 250=5 500=6. Empty - the parameter is entered as a number",
408
+ zh: "以空格分隔的 名称=代码 对,例如 125=4 250=5 500=6。为空 - 参数以数字输入",
409
+ },
410
+ "widget.lora.props.scale": { ru: "Масштаб", en: "Scale", zh: "比例" },
411
+ "widget.lora.props.offset": { ru: "Смещение", en: "Offset", zh: "偏移" },
412
+ "widget.lora.props.min": { ru: "Мин.", en: "Min", zh: "最小" },
413
+ "widget.lora.props.max": { ru: "Макс.", en: "Max", zh: "最大" },
414
+ "widget.lora.props.step": { ru: "Шаг", en: "Step", zh: "步长" },
339
415
  "widget.rgb.title": { ru: "RGB лента", en: "RGB Strip", zh: "RGB 灯带" },
340
416
  "widget.rgb.effect.static": { ru: "Статичный", en: "Static", zh: "静态" },
341
417
  "widget.rgb.effect.rainbow": { ru: "Радуга", en: "Rainbow", zh: "彩虹" },
package/dist/registry.js CHANGED
@@ -17,6 +17,7 @@ import VideoViewer from "./VideoViewer/VideoViewer.svelte";
17
17
  import Widget from "./Widget/Widget.svelte";
18
18
  import WidgetWiFi from "./WidgetWiFi/WidgetWiFi.svelte";
19
19
  import WidgetDeviceInfo from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
20
+ import WidgetLoRa from "./WidgetLoRa/WidgetLoRa.svelte";
20
21
  import WidgetFileSystem from "./WidgetFileSystem/WidgetFileSystem.svelte";
21
22
  import WidgetStackInfo from "./WidgetStackInfo/WidgetStackInfo.svelte";
22
23
  import WidgetRGBStrip from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -44,6 +45,7 @@ const VIEWS = {
44
45
  Widget,
45
46
  WidgetWiFi,
46
47
  WidgetDeviceInfo,
48
+ WidgetLoRa,
47
49
  WidgetFileSystem,
48
50
  WidgetStackInfo,
49
51
  WidgetRGBStrip,
package/dist/types.d.ts CHANGED
@@ -3,9 +3,11 @@ import type { AccentColor } from "./accent";
3
3
  import type { IMissionPlan } from "./WidgetMap/mission/plan";
4
4
  import type { IRoutePlan } from "./WidgetMap/mission/route";
5
5
  import type { IWidgetWiFiConfig, IWidgetDeviceInfoConfig, IWidgetRGBStripConfig, IWidgetPFDData, IWidgetMapData } from "./gui";
6
+ import type { LoRaParams } from "./WidgetLoRa/lora";
6
7
  export type { AccentColor } from "./accent";
7
8
  export type { PropertyChange } from "./propsEditor";
8
9
  export type { IWidgetWiFiConfig, IWidgetDeviceInfoConfig, IWidgetRGBStripConfig, IWidgetPFDData, IWidgetMapData } from "./gui";
10
+ export type { LoRaParams, LoRaParam, LoRaValues, ILoRaParamConfig, ILoRaOption } from "./WidgetLoRa/lora";
9
11
  export type IconSource = ConstructorOfATypedSvelteComponent | string;
10
12
  export interface UIComponentPropsMap {
11
13
  Accordion: IAccordionProps;
@@ -27,6 +29,7 @@ export interface UIComponentPropsMap {
27
29
  Widget: IWidgetProps;
28
30
  WidgetWiFi: IWidgetWiFiProps;
29
31
  WidgetDeviceInfo: IWidgetDeviceInfoProps;
32
+ WidgetLoRa: IWidgetLoRaProps;
30
33
  WidgetFileSystem: IWidgetFileSystemProps;
31
34
  WidgetStackInfo: IWidgetStackInfoProps;
32
35
  WidgetRGBStrip: IWidgetRGBStripProps;
@@ -436,6 +439,10 @@ export interface ITableButton<T extends object> {
436
439
  class?: string | ((row: T) => string);
437
440
  eventHandler?: IUIComponentHandler;
438
441
  onClick?: (row: T) => void;
442
+ hideIf?: {
443
+ key: string;
444
+ value: string | number;
445
+ };
439
446
  }
440
447
  export interface ITableProgressBar<T extends object> {
441
448
  key: keyof T;
@@ -647,6 +654,20 @@ export interface IWidgetDeviceInfoProps {
647
654
  onRestart?: () => void;
648
655
  onFactoryReset?: () => void;
649
656
  }
657
+ export interface IWidgetLoRaProps {
658
+ id?: string;
659
+ wrapperClass?: string;
660
+ accent?: AccentColor;
661
+ label?: {
662
+ name?: string;
663
+ };
664
+ value?: Record<string, unknown>;
665
+ params?: LoRaParams;
666
+ preset?: string;
667
+ collapsed?: boolean;
668
+ persistKey?: string;
669
+ onSave?: (values: Record<string, number>) => void;
670
+ }
650
671
  export interface IWidgetFileSystemFile {
651
672
  Name: string;
652
673
  Size: number;