From ef2dd72105ce1389519637f998780eb6d8b988b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 27 Mar 2023 11:54:51 +0200 Subject: [PATCH 1/2] add base64 method of specifying channel PSK --- docs/configuration/device-config/channels.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/configuration/device-config/channels.mdx b/docs/configuration/device-config/channels.mdx index f18b0c5a..1ef1d670 100644 --- a/docs/configuration/device-config/channels.mdx +++ b/docs/configuration/device-config/channels.mdx @@ -187,6 +187,14 @@ meshtastic --ch-set psk simple15 --ch-index 0 meshtastic --ch-set psk 0x1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b --ch-index 0 ``` +```shell title="Set encryption to your own key on PRIMARY channel (Base64 encoded)" +meshtastic --ch-set psk base64:puavdd7vtYJh8NUVWgxbsoG2u9Sdqc54YvMLs+KNcMA= --ch-index 0 +``` + +:::tip +Use this to copy and paste the `base64` encoded (single channel) key from the meshtastic --info command. Please dont use the omnibus (all channels) code here, it is not a valid key. +::: + ```shell title="Disable encryption on PRIMARY channel" meshtastic --ch-set psk none --ch-index 0 ``` From 2a819c10a5d536aff66959b6e1174e413494d775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 28 Mar 2023 11:40:42 +0200 Subject: [PATCH 2/2] include Neil's ADC calc with attribution --- docs/configuration/device-config/power.mdx | 55 +++++++++++++++++++++- src/utils/calculateADC.ts | 23 +++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/utils/calculateADC.ts diff --git a/docs/configuration/device-config/power.mdx b/docs/configuration/device-config/power.mdx index ecd33888..a85ea6fb 100644 --- a/docs/configuration/device-config/power.mdx +++ b/docs/configuration/device-config/power.mdx @@ -7,6 +7,7 @@ sidebar_label: Power import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; +import calculateADC from "@site/src/utils/calculateADC"; The power config options are: Power Saving, Shutdown after losing power, ADC Multiplier Override Wait Bluetooth Interval, Mesh Super Deep Sleep Timeout, Super Deep Sleep Interval, Light Sleep Interval and Minimum Wake Interval. Power config uses an admin message sending a `Config.Power` protobuf. @@ -28,7 +29,59 @@ Ratio of voltage divider for battery pin e.g. 3.20 (R1=100k, R2=220k) Overrides the ADC_MULTIPLIER defined in the firmware device variant file for battery voltage calculation. -Should be set to floating point value between 2 and 4 +Should be set to floating point value between 2 and 6 + +#### Calibration Process ([Attribution](https://wiki.uniteng.com/en/meshtastic/nano-g1-explorer#calibration-process)) + +1. Install the rechargeable Li-Polymer battery. +2. Charge the battery until full. Indication of this state may vary depending on device. At this point, the battery voltage should be 4.2V +-1%. +3. Input the "Battery Charge Percent" displayed on the screen or in your connected app into the calculator below. +4. If "Battery Charge Percent" (e.g., B 3.82V 60%) is not displayed on the screen, it means that the default value of "Operative Adc Multiplier" is too high. Lower the "Operative Adc Multiplier" to a smaller number (it is recommended to decrease by 0.1) until the screen displays "Battery Charge Percent". Enter the current "Operative Adc Multiplier" in use into the "Operative Adc Multiplier" field in the calculator. Also, input the "Battery Charge Percent" displayed on the screen into the calculator. +5. Click the "Calculate" button to compute the "Calculated New Operative Adc Multiplier", and set it as the new "Operative Adc Multiplier" for the device. + +:::tip ADC Calculator + + + + + + + + + + + + + + + + + + +
Battery Charge Percent: + +
Current Adc Multiplier: + +
Calculated New Operative Adc Multiplier: + +
+ +
+::: + +:::info +It's important to note that this calibration method only maps 4.2V to Battery Charge Percent 100%, and does not address the potential non-linearities of the ADC. +::: ### Wait Bluetooth Interval diff --git a/src/utils/calculateADC.ts b/src/utils/calculateADC.ts new file mode 100644 index 00000000..019ff5e5 --- /dev/null +++ b/src/utils/calculateADC.ts @@ -0,0 +1,23 @@ +export default function calculateADC() { + //const variables + var BAT_MILLIVOLTS_FULL = 4.2; + var BAT_MILLIVOLTS_EMPTY = 3.27; + var BAT_FULL_PERCENT = 1; + //variable + var batteryChargePercent = + parseFloat( + (document.getElementById("batteryChargePercent")).value + ) / 100; + var operativeAdcMultiplier = parseFloat( + (document.getElementById("operativeAdcMultiplier")).value + ); + var result = + (operativeAdcMultiplier * + ((BAT_FULL_PERCENT - 1) * BAT_MILLIVOLTS_EMPTY - + BAT_FULL_PERCENT * BAT_MILLIVOLTS_FULL)) / + ((batteryChargePercent - 1) * BAT_MILLIVOLTS_EMPTY - + batteryChargePercent * BAT_MILLIVOLTS_FULL); + (( + document.getElementById("newOperativeAdcMultiplier") + )).value = result.toFixed(4); +}