progress on mcus
This commit is contained in:
parent
b1c92296a6
commit
f27dbcee8c
|
@ -1,16 +1,18 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import A4 from "../../zhen/notes/physics/sharedComps/A4.svelte";
|
import A4 from "../../zhen/notes/physics/sharedComps/A4.svelte";
|
||||||
import { BatteryLifeCalculator } from "./pageSrc/BatteryCalc";
|
import { BatteryLifeCalculator } from "./pageSrc/BatteryCalc";
|
||||||
|
import { getMCU, type MCU_Type } from "./pageSrc/MCU_defs";
|
||||||
|
|
||||||
let mathMachine = new BatteryLifeCalculator();
|
let mathMachine = new BatteryLifeCalculator();
|
||||||
|
|
||||||
let useCustom: boolean = false;
|
let useCustom: boolean = false;
|
||||||
let selectedText: string = "";
|
let selectedText: string = "";
|
||||||
|
let selectedMcu: MCU_Type | undefined = undefined;
|
||||||
|
$: selectedMcu = getMCU(selectedText)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const options = ["esp32-s3", "Text Two", "Text Three"];
|
const options = ["esp32-s3", "esp32-s3"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex justify-center pt-10">
|
<div class="flex justify-center pt-10">
|
||||||
|
@ -82,21 +84,28 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !useCustom}
|
{#if !useCustom}
|
||||||
<select
|
<div>
|
||||||
bind:value={selectedText}
|
<select
|
||||||
class="select select-sm select-bordered w-56 max-w-xs"
|
bind:value={selectedText}
|
||||||
>
|
class="select select-sm select-bordered w-56 max-w-xs"
|
||||||
<option disabled value="">Select a text</option>
|
>
|
||||||
{#each options as option}
|
<option disabled value="">Select a text</option>
|
||||||
<option value={option}>{option}</option>
|
{#each options as option}
|
||||||
{/each}
|
<option value={option}>{option}</option>
|
||||||
</select>
|
{/each}
|
||||||
|
</select>
|
||||||
|
|
||||||
{#if selectedText}
|
{#if selectedMcu != undefined && selectedMcu?.wifi != undefined}
|
||||||
<p class="mt-4 text-lg">
|
<p class="mt-4 text-lg">
|
||||||
You selected: {selectedText}
|
wifi
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if selectedMcu != undefined && selectedMcu?.wifi != undefined}
|
||||||
|
<p class="mt-4 text-lg">
|
||||||
|
ble
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<span class="text-sm text-slate-300 text-opacity-60"
|
<span class="text-sm text-slate-300 text-opacity-60"
|
||||||
|
|
|
@ -6,9 +6,9 @@ export interface MCU_Type {
|
||||||
bluetooth?: { [key: string]: Number };
|
bluetooth?: { [key: string]: Number };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MCUs: MCU_Type[] = [
|
const MCUs: MCU_Type[] = [
|
||||||
{
|
{
|
||||||
name: "ESP32-S3",
|
name: "esp32-s3",
|
||||||
cpu: { // mili amps
|
cpu: { // mili amps
|
||||||
single_core_40MHz: 21.8,
|
single_core_40MHz: 21.8,
|
||||||
dual_core_40MHz: 24.4,
|
dual_core_40MHz: 24.4,
|
||||||
|
@ -33,7 +33,7 @@ export const MCUs: MCU_Type[] = [
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "ESP32-C3",
|
name: "esp32-c3",
|
||||||
cpu: {
|
cpu: {
|
||||||
single_core_80MHz: 22,
|
single_core_80MHz: 22,
|
||||||
single_core_160MHz: 54.6,
|
single_core_160MHz: 54.6,
|
||||||
|
@ -51,3 +51,13 @@ export const MCUs: MCU_Type[] = [
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export function getMCU(name: string): MCU_Type | undefined{
|
||||||
|
for (let i = 0; i < MCUs.length; i++) {
|
||||||
|
const element = MCUs[i];
|
||||||
|
if (element.name == name)
|
||||||
|
return element
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
Loading…
Reference in a new issue