📦 Moves models to /types

This commit is contained in:
Rune Harlyk
2024-08-19 20:40:03 +02:00
committed by Rune Harlyk
parent cfa729ff70
commit a0c58841d7
12 changed files with 82 additions and 185 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
import { fade, fly } from 'svelte/transition';
import Login from '~icons/tabler/login';
import { api } from '$lib/api';
import type { JWT } from '$lib/models';
import type { JWT } from '$lib/types/models';
type SignInData = {
password: string;
@@ -11,7 +11,7 @@
import { compareVersions } from 'compare-versions';
import { onMount } from 'svelte';
import { api } from '$lib/api';
import type { GithubRelease } from '$lib/models';
import type { GithubRelease } from '$lib/types/models';
import { useFeatureFlags } from '$lib/stores/featureFlags';
const features = useFeatureFlags();
-169
View File
@@ -1,169 +0,0 @@
export type vector = { x: number; y: number };
export interface ControllerInput {
left: vector;
right: vector;
height: number;
speed: number;
s1: number;
}
export type GithubRelease = {
message: string;
tag_name: string;
assets: Array<{
name: string;
browser_download_url: string;
}>;
};
export type JWT = { access_token: string };
export type angles = number[] | Int16Array;
export type WifiStatus = {
status: number;
local_ip: string;
mac_address: string;
rssi: number;
ssid: string;
bssid: string;
channel: number;
subnet_mask: string;
gateway_ip: string;
dns_ip_1: string;
dns_ip_2?: string;
};
export type WifiSettings = {
hostname: string;
priority_RSSI: boolean;
wifi_networks: NetworkItem[];
};
export type NetworkList = {
networks: NetworkItem[];
};
export type KnownNetworkItem = {
ssid: string;
password: string;
static_ip_config: boolean;
local_ip?: string;
subnet_mask?: string;
gateway_ip?: string;
dns_ip_1?: string;
dns_ip_2?: string;
};
export type NetworkItem = {
rssi: number;
ssid: string;
bssid: string;
channel: number;
encryption_type: number;
};
export type ApStatus = {
status: number;
ip_address: string;
mac_address: string;
station_num: number;
};
export type ApSettings = {
provision_mode: number;
ssid: string;
password: string;
channel: number;
ssid_hidden: boolean;
max_clients: number;
local_ip: string;
gateway_ip: string;
subnet_mask: string;
};
export type LightState = {
led_on: boolean;
};
export type NTPStatus = {
status: number;
utc_time: string;
local_time: string;
server: string;
uptime: number;
};
export type NTPSettings = {
enabled: boolean;
server: string;
tz_label: string;
tz_format: string;
};
export type Analytics = {
max_alloc_heap: number;
psram_size: number;
free_psram: number;
free_heap: number;
total_heap: number;
min_free_heap: number;
core_temp: number;
fs_total: number;
fs_used: number;
uptime: number;
};
export type StaticSystemInformation = {
esp_platform: string;
firmware_version: string;
cpu_freq_mhz: number;
cpu_type: string;
cpu_rev: number;
cpu_cores: number;
sketch_size: number;
free_sketch_space: number;
sdk_version: string;
arduino_version: string;
flash_chip_size: number;
flash_chip_speed: number;
cpu_reset_reason: string;
};
export type SystemInformation = Analytics & StaticSystemInformation;
export type CameraSettings = {
framesize: number;
quality: number;
brightness: number;
contrast: number;
saturation: number;
sharpness: number;
denoise: number;
special_effect: number;
wb_mode: number;
vflip: boolean;
hmirror: boolean;
};
export type File = number;
export interface Directory {
[key: string]: File | Directory;
}
export type Servo = {
name: string;
channel: number;
inverted: boolean;
angle: number;
center_angle: number;
};
export type ServoConfiguration = {
is_active: boolean;
servo_pwm_frequency: number;
servo_oscillator_frequency: number;
servos: Servo[];
};
+10 -2
View File
@@ -1,4 +1,4 @@
import type { ControllerInput } from '$lib/models';
import type { ControllerInput } from '$lib/types/models';
import { persistentStore } from '$lib/utilities/svelte-utilities';
import { writable, type Writable } from 'svelte/store';
@@ -8,7 +8,15 @@ export const jointNames = persistentStore('joint_names', []);
export const model = writable();
export const modes = ['deactivated', 'idle', 'calibration', 'rest', 'stand', 'crawl', 'walk'] as const;
export const modes = [
'deactivated',
'idle',
'calibration',
'rest',
'stand',
'crawl',
'walk'
] as const;
export type Modes = (typeof modes)[number];
+1 -1
View File
@@ -1,5 +1,5 @@
import { writable, type Writable } from 'svelte/store';
import { type angles } from '$lib/models';
import { type angles } from '$lib/types/models';
export const servoAnglesOut: Writable<number[]> = writable([
0, 45, -90, 0, 45, -90, 0, 45, -90, 0, 45, -90
+63 -5
View File
@@ -1,3 +1,26 @@
export type vector = { x: number; y: number };
export interface ControllerInput {
left: vector;
right: vector;
height: number;
speed: number;
s1: number;
}
export type GithubRelease = {
message: string;
tag_name: string;
assets: Array<{
name: string;
browser_download_url: string;
}>;
};
export type JWT = { access_token: string };
export type angles = number[] | Int16Array;
export type WifiStatus = {
status: number;
local_ip: string;
@@ -18,6 +41,10 @@ export type WifiSettings = {
wifi_networks: KnownNetworkItem[];
};
export type NetworkList = {
networks: NetworkItem[];
};
export type KnownNetworkItem = {
ssid: string;
password: string;
@@ -64,10 +91,6 @@ export type NTPStatus = {
uptime: number;
};
export type RSSI = {
rssi: number;
ssid: string;
};
export type Battery = {
voltage: number;
@@ -140,4 +163,39 @@ export interface I2CDevice {
address: number;
part_number: string;
name: string;
};
};
export type CameraSettings = {
framesize: number;
quality: number;
brightness: number;
contrast: number;
saturation: number;
sharpness: number;
denoise: number;
special_effect: number;
wb_mode: number;
vflip: boolean;
hmirror: boolean;
};
export type File = number;
export interface Directory {
[key: string]: File | Directory;
}
export type Servo = {
name: string;
channel: number;
inverted: boolean;
angle: number;
center_angle: number;
};
export type ServoConfiguration = {
is_active: boolean;
servo_pwm_frequency: number;
servo_oscillator_frequency: number;
servos: Servo[];
};
+1 -1
View File
@@ -10,7 +10,7 @@
type Modes,
ModesEnum
} from '$lib/stores';
import type { vector } from '$lib/models';
import type { vector } from '$lib/types/models';
import VerticalSlider from '$lib/components/input/vertical-slider.svelte';
let throttle = new throttler();
@@ -1,7 +1,7 @@
<script lang="ts">
import { api } from '$lib/api';
import Spinner from '$lib/components/Spinner.svelte';
import type { CameraSettings } from '$lib/models';
import type { CameraSettings } from '$lib/types/models';
let settings:CameraSettings
const getCameraSettings = async () => {
@@ -1,5 +1,5 @@
<script lang="ts">
import type { Servo } from "$lib/models";
import type { Servo } from "$lib/types/models";
import { createEventDispatcher } from "svelte";
export let servo: Servo;
@@ -1,6 +1,6 @@
<script lang="ts">
import SettingsCard from '$lib/components/SettingsCard.svelte';
import type { ServoConfiguration, Servo } from '$lib/models';
import type { ServoConfiguration, Servo } from '$lib/types/models';
import MotorOutline from '~icons/mdi/motor-outline';
import ServoController from './servo.svelte';
import Spinner from '$lib/components/Spinner.svelte';
@@ -4,7 +4,7 @@
import FolderIcon from '~icons/mdi/folder-outline';
import Folder from "./Folder.svelte";
import { api } from "$lib/api";
import type { Directory } from "$lib/models";
import type { Directory } from "$lib/types/models";
let filename = '';
+1 -1
View File
@@ -10,7 +10,7 @@
import RssiIndicator from '$lib/components/statusbar/RSSIIndicator.svelte';
import type { NetworkItem } from '$lib/types/models';
import { api } from '$lib/api';
import type { NetworkList } from '$lib/models';
import type { NetworkList } from '$lib/types/models';
// provided by <Modals />
export let isOpen: boolean;