sync
This commit is contained in:
parent
ece1ed6bbe
commit
d8416aa883
|
@ -1,12 +1,16 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import A4 from "../../zhen/notes/physics/sharedComps/A4.svelte";
|
import A4 from "../../zhen/notes/physics/sharedComps/A4.svelte";
|
||||||
import { BatteryLifeCalculator } from "./comps/BatteryCalc";
|
import { BatteryLifeCalculator } from "./pageSrc/BatteryCalc";
|
||||||
|
|
||||||
let mathMachine = new BatteryLifeCalculator();
|
let mathMachine = new BatteryLifeCalculator();
|
||||||
|
|
||||||
let useCustom = false;
|
let useCustom: boolean = false;
|
||||||
let selectedText = '';
|
let selectedText: string = "";
|
||||||
const options = ["Text One", "Text Two", "Text Three"];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const options = ["esp32-s3", "Text Two", "Text Three"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex justify-center pt-10">
|
<div class="flex justify-center pt-10">
|
||||||
|
@ -28,33 +32,33 @@
|
||||||
<div class="p-4 bg-base-200 rounded-lg">
|
<div class="p-4 bg-base-200 rounded-lg">
|
||||||
<h2 class="text-2xl font-bolc">Software</h2>
|
<h2 class="text-2xl font-bolc">Software</h2>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div class="form-control">
|
||||||
<span class="text-sm text-slate-300 text-opacity-60"
|
<span class="text-sm text-slate-300 text-opacity-60"
|
||||||
>Duration of code execution</span
|
>Duration of code execution</span
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="join">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
class="bg-slate-600 bg-opacity-60 rounded-l-lg appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
class="input input-bordered input-sm join-item appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="bg-slate-500 bg-opacity-60 rounded-r-lg"
|
class="bg-base-content bg-opacity-60 join-item grid place-content-center"
|
||||||
>
|
>
|
||||||
<span class="text-center pl-1 pr-2">sec</span>
|
<span class="text-center pl-1 pr-2">sec</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-control">
|
||||||
<span class="text-sm text-slate-300 text-opacity-60"
|
<span class="text-sm text-slate-300 text-opacity-60"
|
||||||
>sleep time</span
|
>sleep time</span
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="join">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
class="bg-slate-600 bg-opacity-60 rounded-l-lg appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
class="input input-bordered input-sm join-item appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="bg-slate-500 bg-opacity-60 rounded-r-lg"
|
class="bg-base-content bg-opacity-60 join-item grid place-content-center"
|
||||||
>
|
>
|
||||||
<span class="text-center pl-1 pr-2">sec</span>
|
<span class="text-center pl-1 pr-2">sec</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,13 +68,24 @@
|
||||||
<div class="col-span-full">
|
<div class="col-span-full">
|
||||||
<h2 class=" text-2xl font-bolc">Hardware</h2>
|
<h2 class=" text-2xl font-bolc">Hardware</h2>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="text-sm text-slate-300 text-opacity-60 text">Use custom values</div>
|
<div
|
||||||
<input bind:checked={useCustom} class="ml-2 checkbox checkbox-xs my-auto" type="checkbox" />
|
class="text-sm text-slate-300 text-opacity-60 text"
|
||||||
|
>
|
||||||
|
Use custom values
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
bind:checked={useCustom}
|
||||||
|
class="ml-2 checkbox checkbox-xs my-auto"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !useCustom}
|
{#if !useCustom}
|
||||||
<select bind:value={selectedText} class="select select-sm select-bordered w-full max-w-xs">
|
<select
|
||||||
|
bind:value={selectedText}
|
||||||
|
class="select select-sm select-bordered w-56 max-w-xs"
|
||||||
|
>
|
||||||
<option disabled value="">Select a text</option>
|
<option disabled value="">Select a text</option>
|
||||||
{#each options as option}
|
{#each options as option}
|
||||||
<option value={option}>{option}</option>
|
<option value={option}>{option}</option>
|
||||||
|
@ -78,34 +93,44 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
{#if selectedText}
|
{#if selectedText}
|
||||||
<p class="mt-4 text-lg">You selected: {selectedText}</p>
|
<p class="mt-4 text-lg">
|
||||||
|
You selected: {selectedText}
|
||||||
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div>
|
<div class="form-control">
|
||||||
<span class="text-sm text-slate-300 text-opacity-60"
|
<span class="text-sm text-slate-300 text-opacity-60"
|
||||||
>Duration of code execution</span
|
>Duration of code execution</span
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="join">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
class="bg-slate-600 bg-opacity-60 rounded-l-lg appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
class="input input-bordered input-sm join-item appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
||||||
/>
|
/>
|
||||||
<div class="bg-slate-500 bg-opacity-60 rounded-r-lg">
|
<div
|
||||||
<span class="text-center pl-1 pr-2">sec</span>
|
class="bg-base-content bg-opacity-60 join-item grid place-content-center"
|
||||||
|
>
|
||||||
|
<span class="text-center pl-1 pr-2"
|
||||||
|
>sec</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-control">
|
||||||
<span class="text-sm text-slate-300 text-opacity-60"
|
<span class="text-sm text-slate-300 text-opacity-60"
|
||||||
>sleep time</span
|
>sleep time</span
|
||||||
>
|
>
|
||||||
<div class="flex">
|
<div class="join">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
class="bg-slate-600 bg-opacity-60 rounded-l-lg appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
class="input input-bordered input-sm join-item appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
||||||
/>
|
/>
|
||||||
<div class="bg-slate-500 bg-opacity-60 rounded-r-lg">
|
<div
|
||||||
<span class="text-center pl-1 pr-2">sec</span>
|
class="bg-base-content bg-opacity-60 join-item grid place-content-center"
|
||||||
|
>
|
||||||
|
<span class="text-center pl-1 pr-2"
|
||||||
|
>sec</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,12 +142,14 @@
|
||||||
Source for the calculations is at this
|
Source for the calculations is at this
|
||||||
<a
|
<a
|
||||||
class="text-blue-500 underline"
|
class="text-blue-500 underline"
|
||||||
|
target="_blank"
|
||||||
href="https://github.com/simonneutert/batterylife-calculator"
|
href="https://github.com/simonneutert/batterylife-calculator"
|
||||||
>github</a
|
>github</a
|
||||||
>
|
>
|
||||||
and the
|
and the
|
||||||
<a
|
<a
|
||||||
class="text-blue-500 underline"
|
class="text-blue-500 underline"
|
||||||
|
target="_blank "
|
||||||
href="https://www.of-things.de/battery-life-calculator.php"
|
href="https://www.of-things.de/battery-life-calculator.php"
|
||||||
>original website.</a
|
>original website.</a
|
||||||
>
|
>
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
export interface MCU_Type {
|
||||||
|
name: string;
|
||||||
|
cpu: { [key: string]: Number }; // state: power consumption
|
||||||
|
sleep: { [key: string]: Number };
|
||||||
|
wifi?: { [key: string]: Number };
|
||||||
|
bluetooth?: { [key: string]: Number };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const MCUs: MCU_Type[] = [
|
||||||
|
{
|
||||||
|
name: "ESP32-S3",
|
||||||
|
cpu: { // mili amps
|
||||||
|
single_core_40MHz: 21.8,
|
||||||
|
dual_core_40MHz: 24.4,
|
||||||
|
single_core_80MHz: 42.6,
|
||||||
|
dual_core_80MHz: 47.3,
|
||||||
|
single_core_160MHz: 54.6,
|
||||||
|
dual_core_160MHz: 54.1,
|
||||||
|
single_core_240MHz: 65.9,
|
||||||
|
dual_core_240MHz: 81.3,
|
||||||
|
},
|
||||||
|
sleep: {
|
||||||
|
|
||||||
|
},
|
||||||
|
wifi: { //
|
||||||
|
dBm_21: 318.2,
|
||||||
|
sleep: 10
|
||||||
|
},
|
||||||
|
bluetooth: {
|
||||||
|
active: 100,
|
||||||
|
sleep: 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "ESP32-C3",
|
||||||
|
cpu: {
|
||||||
|
active: 130,
|
||||||
|
sleep: 15
|
||||||
|
},
|
||||||
|
sleep: {
|
||||||
|
|
||||||
|
},
|
||||||
|
wifi: {
|
||||||
|
active: 110,
|
||||||
|
sleep: 9
|
||||||
|
},
|
||||||
|
bluetooth: {
|
||||||
|
active: 90,
|
||||||
|
sleep: 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
Loading…
Reference in New Issue