progress on mcus
This commit is contained in:
parent
b1c92296a6
commit
f27dbcee8c
|
@ -1,16 +1,18 @@
|
|||
<script lang="ts">
|
||||
import A4 from "../../zhen/notes/physics/sharedComps/A4.svelte";
|
||||
import { BatteryLifeCalculator } from "./pageSrc/BatteryCalc";
|
||||
import { getMCU, type MCU_Type } from "./pageSrc/MCU_defs";
|
||||
|
||||
let mathMachine = new BatteryLifeCalculator();
|
||||
|
||||
let useCustom: boolean = false;
|
||||
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>
|
||||
|
||||
<div class="flex justify-center pt-10">
|
||||
|
@ -82,21 +84,28 @@
|
|||
</div>
|
||||
|
||||
{#if !useCustom}
|
||||
<select
|
||||
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 value={option}>{option}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<div>
|
||||
<select
|
||||
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 value={option}>{option}</option>
|
||||
{/each}
|
||||
</select>
|
||||
|
||||
{#if selectedText}
|
||||
<p class="mt-4 text-lg">
|
||||
You selected: {selectedText}
|
||||
</p>
|
||||
{/if}
|
||||
{#if selectedMcu != undefined && selectedMcu?.wifi != undefined}
|
||||
<p class="mt-4 text-lg">
|
||||
wifi
|
||||
</p>
|
||||
{/if}
|
||||
{#if selectedMcu != undefined && selectedMcu?.wifi != undefined}
|
||||
<p class="mt-4 text-lg">
|
||||
ble
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="form-control">
|
||||
<span class="text-sm text-slate-300 text-opacity-60"
|
||||
|
|
|
@ -6,9 +6,9 @@ export interface MCU_Type {
|
|||
bluetooth?: { [key: string]: Number };
|
||||
}
|
||||
|
||||
export const MCUs: MCU_Type[] = [
|
||||
const MCUs: MCU_Type[] = [
|
||||
{
|
||||
name: "ESP32-S3",
|
||||
name: "esp32-s3",
|
||||
cpu: { // mili amps
|
||||
single_core_40MHz: 21.8,
|
||||
dual_core_40MHz: 24.4,
|
||||
|
@ -33,7 +33,7 @@ export const MCUs: MCU_Type[] = [
|
|||
},
|
||||
|
||||
{
|
||||
name: "ESP32-C3",
|
||||
name: "esp32-c3",
|
||||
cpu: {
|
||||
single_core_80MHz: 22,
|
||||
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