From 757769af1b6067609cb99d4b6be2f4c0520aaac6 Mon Sep 17 00:00:00 2001 From: lekrsu Date: Wed, 4 Oct 2023 14:42:02 +0200 Subject: [PATCH] calculator --- README.md | 13 ++++++------ calculator/index.html | 20 +++++++++++++++++++ calculator/script.js | 17 ++++++++++++++++ calculator/style.css | 46 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 calculator/index.html create mode 100644 calculator/script.js create mode 100644 calculator/style.css diff --git a/README.md b/README.md index 0c7b382..721b2ed 100644 --- a/README.md +++ b/README.md @@ -119,17 +119,16 @@ The calculations and principles discussed in this section have been applied to c - Phase limits are customizable for torque and flux. The default settings are 65A for torque and 30A for flux. -#### ADC modding info (upcoming) +#### ADC modding info -130k original 10s->12s (13s not really safe but works) +In the context of ADC modding, you can utilize the following interactive calculator to help with your calculations. This calculator is designed for dark mode, ensuring readability in various environments. -160k 13s +
+ +
-200k 15s -240k 16-17s - -270k 20s +**Note**: Make sure to adjust Radc, as it plays a significant role in ADC modding. ### License diff --git a/calculator/index.html b/calculator/index.html new file mode 100644 index 0000000..f7d3f66 --- /dev/null +++ b/calculator/index.html @@ -0,0 +1,20 @@ + + + + + + + ADC Offset Calculator + + +

ADC Offset Calculator

+ + +
+ +
+
+ + + + diff --git a/calculator/script.js b/calculator/script.js new file mode 100644 index 0000000..e759199 --- /dev/null +++ b/calculator/script.js @@ -0,0 +1,17 @@ +document.addEventListener("DOMContentLoaded", function () { + const calculateButton = document.getElementById("calculateButton"); + calculateButton.addEventListener("click", calculate); + + function calculate() { + const Radc = parseFloat(document.getElementById("inputRadc").value); + + if (!isNaN(Radc)) { + const maxVoltage = 3.3; // Fixed value for Max STM voltage + const R1 = 10000; // Fixed value for R1 + const Vmax = (maxVoltage * (Radc + R1)) / R1; + document.getElementById("result").textContent = `Max Battery Voltage (Vmax): ${Vmax.toFixed(2)}V`; + } else { + document.getElementById("result").textContent = "Please enter a valid Radc value."; + } + } +}); diff --git a/calculator/style.css b/calculator/style.css new file mode 100644 index 0000000..e16b00f --- /dev/null +++ b/calculator/style.css @@ -0,0 +1,46 @@ +/* Apply a dark background color to the entire calculator */ +body { + background-color: #333; + color: #fff; + font-family: Arial, sans-serif; +} + +/* Style the calculator container */ +h1 { + font-size: 24px; +} + +/* Style the input field */ +input[type="number"] { + width: 300px; + padding: 10px; + background-color: #444; + color: #fff; + border: 1px solid #666; + border-radius: 5px; + margin-bottom: 10px; +} + +/* Style the Calculate button */ +button { + padding: 10px 20px; + background-color: #007acc; + color: #fff; + border: none; + border-radius: 5px; + cursor: pointer; +} + +/* Style the result div */ +#result { + margin-top: 10px; + padding: 10px; + background-color: #555; + color: #fff; + border-radius: 5px; +} + +/* Change button style on hover */ +button:hover { + background-color: #005a9e; +}