diff --git a/src/routes/tools/battery-life-calculator/+page.svelte b/src/routes/tools/battery-life-calculator/+page.svelte index 99f8312..48a9b13 100644 --- a/src/routes/tools/battery-life-calculator/+page.svelte +++ b/src/routes/tools/battery-life-calculator/+page.svelte @@ -1,12 +1,16 @@ -
@@ -28,33 +32,33 @@

Software

-
+
Duration of code execution -
+
sec
-
+
sleep time -
+
sec
@@ -64,51 +68,72 @@

Hardware

-
Use custom values
- +
+ Use custom values +
+
{#if !useCustom} - - - {#if selectedText} -

You selected: {selectedText}

- {/if} + + + {#if selectedText} +

+ You selected: {selectedText} +

+ {/if} {:else} -
- Duration of code execution -
- -
- sec +
+ Duration of code execution +
+ +
+ sec +
-
-
- sleep time -
- -
- sec +
+ sleep time +
+ +
+ sec +
-
{/if}
@@ -117,12 +142,14 @@ Source for the calculations is at this github and the original website. diff --git a/src/routes/tools/battery-life-calculator/comps/BatteryCalc.js b/src/routes/tools/battery-life-calculator/pageSrc/BatteryCalc.js similarity index 100% rename from src/routes/tools/battery-life-calculator/comps/BatteryCalc.js rename to src/routes/tools/battery-life-calculator/pageSrc/BatteryCalc.js diff --git a/src/routes/tools/battery-life-calculator/pageSrc/MCU_defs.ts b/src/routes/tools/battery-life-calculator/pageSrc/MCU_defs.ts new file mode 100644 index 0000000..ab20115 --- /dev/null +++ b/src/routes/tools/battery-life-calculator/pageSrc/MCU_defs.ts @@ -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 + } + } +];