From 08b185e641faec1b99f2de5ae79f0ccb991676fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 9 Nov 2022 12:17:06 +0100 Subject: [PATCH] module config updates --- docs/configuration/module-config/audio.mdx | 129 ++++++++++++++++++ .../module-config/canned-message.mdx | 27 +++- .../module-config/external-notification.mdx | 3 +- docs/configuration/module-config/index.mdx | 1 + docs/configuration/module-config/serial.mdx | 18 ++- .../configuration/module-config/telemetry.mdx | 2 +- 6 files changed, 168 insertions(+), 12 deletions(-) create mode 100644 docs/configuration/module-config/audio.mdx diff --git a/docs/configuration/module-config/audio.mdx b/docs/configuration/module-config/audio.mdx new file mode 100644 index 00000000..dd5f546c --- /dev/null +++ b/docs/configuration/module-config/audio.mdx @@ -0,0 +1,129 @@ +--- +id: audio +title: Audio Module Configuration +slug: /settings/moduleconfig/audio +sidebar_label: Audio +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +The audio module config options are: Codec2 Enabled, Microphone ADC Channel, Speaker PWM GPIO, PTT GPIO, Audio Bitrate/Codec Mode. Audio Module config uses an admin message sending a `ConfigModule.Audio` protobuf. + +With this **experimental** module, you can add a microphone and speaker to any ESP32 device that has a SX128x radio and operates on the 2.4 GHz ISM Band. The Sub-1GHz bands are not wide enough to support continuous audio packets on the mesh, even in the Short and Fast modes. Right now, the only device supported is the LilyGo TLora 2.1-1.8 board. + +## Audio Module Config Values + +### Codec2 Enabled + +Enables the audio module. + +### Microphone ADC Channel + +The ADC channel to use for the microphone. The default is 6 which maps to GPIO 34 on the ESP32. + +### Speaker PWM GPIO + +The GPIO to use for the speaker. The default is GPIO 14 on the ESP32. + +### PTT GPIO + +The GPIO to use for the Push-To-Talk button. The default is GPIO 39 on the ESP32. + +### Audio Bitrate/Codec Mode + +The bitrate to use for audio. The default is `CODEC2_700B`. The available options are: + + * CODEC2_DEFAULT + * CODEC2_3200 + * CODEC2_2400 + * CODEC2_1600 + * CODEC2_1400 + * CODEC2_1300 + * CODEC2_1200 + * CODEC2_700B + * CODEC2_700 + +## Audio Module Config Client Availability + + + + +:::info +Audio module config is not available for Android. +::: + + + + +:::info +Audio module config is not available on iOS, iPadOS and macOS. +::: + + + + +All audio module config options are available in the python CLI. Example commands are below: + +| Setting | Acceptable Values | Default | +| :-------------------: | :-----------------: | :-----: | +| audio.enabled | `true`, `false` | `false` | +| audio.mic_chan | ADC Number 0-7 | Default of `6` is Unset | +| audio.amp_pin | GPIO Pin Number 1-33 | Default of `14` is Unset | +| audio.ptt_pin | GPIO Pin Number 1-39 | Default of `39` is Unset | +| audio.bitrate | `CODEC2_DEFAULT` `CODEC2_3200` `CODEC2_2400` `CODEC2_1600` `CODEC2_1400` `CODEC2_1300` `CODEC2_1200` `CODEC2_700B` `CODEC2_700` | `CODEC2_DEFAULT` | + + +```shell title="Enable / Disable Module" +meshtastic --set audio.enabled true +meshtastic --set audio.enabled false +``` + +```shell title="Set ADC Channel number 7" +meshtastic --set audio.mic_chan 7 +``` + +```shell title="Set PWM to GPIO pin number 28" +meshtastic --set audio.amp_pin 28 +``` + +```shell title="Set PTT to GPIO pin number 37" +meshtastic --set audio.ptt_pin 37 +``` + +```shell title="Set Codec Bitrate" +meshtastic --set audio.bitrate CODEC2_DEFAULT +meshtastic --set audio.bitrate CODEC2_1400 +``` + + + + +:::info +No audio module config options are available in the Flasher. +::: + + + + +:::info +All audio module config options are available in the Web UI. +::: + + + + +:::warning +GPIO access is fundamentally dangerous because invalid options can physically damage or destroy your hardware. Ensure that you fully understand the schematic for your particular device before trying this as we do not offer a warranty. Use at your own risk. + +This module requires attaching a peripheral accessory to your device. It will not work without one. +::: diff --git a/docs/configuration/module-config/canned-message.mdx b/docs/configuration/module-config/canned-message.mdx index 13d47292..52537a83 100644 --- a/docs/configuration/module-config/canned-message.mdx +++ b/docs/configuration/module-config/canned-message.mdx @@ -35,9 +35,9 @@ Input event sources accepted by the canned message module. | Value | Description | | :----------: | :---------------------------------------------------------------------: | -| `_any` | Default. Allows any peripheral input device connected to the device. | +| `_any` | Default. Allows any peripheral input device connected to the device. | | `rotEnc1` | Basic Rotary Encoder | -| `upDownEnc1` | Up Down Encoder (use this also for RAK14006) | +| `upDownEnc1` | Up Down Encoder (use this also for RAK14006 Rotary Encoder) | | `cardkb` | M5 Stack CardKB (this covers RAK14004 Keymatrix) | ### Rotary Encoder Enabled @@ -140,7 +140,7 @@ meshtastic --set canned_message.allow_input_source "rotEnc1" ``` ```shell title="Enable/Disable rotary1" -meshtastic --set +meshtastic --set canned_message.rotary1_enabled 1 ``` ```shell title="Set/Unset Encoder Pin A" @@ -197,11 +197,28 @@ This module requires attaching a peripheral accessory to your device. It will no ## Hardware -To navigate through messages and select one, you will require some hardware attached to your device. Currently, the module is tested with a generic rotary encoder, but this is not a limitation further input methods can be added in the future. +To navigate through messages and select one, you will require some hardware attached to your device. Currently, the module is tested with a generic rotary encoder, an up/down/select 3 button logic and several I2C Keyboards. Further input methods will be added in the future. + +### I2C Keymatrix + +This is tested with the RAK14004 Keyboard. A keypress will immediately send the message attached to the button number. Buttons are numbered from upper left to lower right on the keypanels. So pressing the upper left button will send the first message. The second button will send the second message and so on. + +**Caveat:** the RAK 3x4 keymatrix is missing the 4th button row while scanning, so you have to skip every 4th message slot. Button 1 sends message 1 and button 4 will send message 5 +Example: 1|2|3||5|6|7||9|10|11||13|14|15 - the slots 4,8 and 12 can not be used. + +### CardKB + +The CardKB is fully supported in freetext mode and select mode. Use UP/DOWN/ENTER to select a predefined message and send it. For a freetext message, just type it in and press ENTER to send it. + +If you don't want to broadcast your freetext message, you can use the CardKB to send it to a specific node. Just press TAB and select the target node with the LEFT/RIGHT keys. The message will be sent to the node with the matching name and node number. The target node will be remebered for your nexxt message. + +### 3 Buttun up/down and RAK rotary encoder + +Just use UP/DOWN/ENTER to select a predefined message and send it. ### Rotary encoder -Meshtastic supports hardwired rotary encoders as input devices. (Technically the Canned Message Module is independent of rotary encoders. It is described here, because no other module utilizes rotary encoders just yet.) +Meshtastic supports hardwired rotary encoders as input devices. You will need a generic rotary encoder. The types listed below has five legs where two is dedicated to a "press" action, but any other types will likely do the job. You can also use a three-legged version, where the "press" action should be wired from an independent switch. diff --git a/docs/configuration/module-config/external-notification.mdx b/docs/configuration/module-config/external-notification.mdx index 63c01f73..293992b7 100644 --- a/docs/configuration/module-config/external-notification.mdx +++ b/docs/configuration/module-config/external-notification.mdx @@ -30,7 +30,7 @@ Specifies whether the external circuit is triggered when the device's GPIO is lo ### GPIO to monitor -Specifies the GPIO that your external circuit is attached to on the device. +Specifies the GPIO that your external circuit is attached to on the device. On devices that have a PWM buzzer, you can use the buzzer for notifications by setting this to the same pin the buzzer uses. :::info On ESP32 based boards, GPIOs 34 to 39 are GPIs – input only pins. These pins do not have internal pull-up or pull-down resistors. They can not be used as outputs, so you can NOT use these pins as outputs. @@ -160,5 +160,4 @@ Ideas for external hardware: ## Known Problems -- This won't directly support a passive (normal) speaker as it does not generate any audio wave forms. - This module only monitors text messages. We won't trigger on any other packet types. diff --git a/docs/configuration/module-config/index.mdx b/docs/configuration/module-config/index.mdx index d7b575db..76d594df 100644 --- a/docs/configuration/module-config/index.mdx +++ b/docs/configuration/module-config/index.mdx @@ -10,6 +10,7 @@ Modules are included in the firmware and allow users to extend the functionality | Name | Description | |:----:|:-----------:| +| [Audio](/docs/settings/moduleconfig/audio) | enable Support for Codec2 Voice Comms on certain devices | | [Canned Message](/docs/settings/moduleconfig/canned-message) | Set a number of predefined messages to send out directly from the device with the use of an input device like a rotary encoder. | | [External Notification](/docs/settings/moduleconfig/external-notification) | Incoming messages are able to alert you using circuits you attach to the device (LEDs, Buzzers, etc) | | [MQTT](/docs/settings/moduleconfig/mqtt) | Forward packets along to an MQTT server. This allows users on the local mesh to communicate with users on another mesh over the internet. | diff --git a/docs/configuration/module-config/serial.mdx b/docs/configuration/module-config/serial.mdx index 97d73831..99c7968c 100644 --- a/docs/configuration/module-config/serial.mdx +++ b/docs/configuration/module-config/serial.mdx @@ -24,13 +24,23 @@ If set, any packets you send will be echoed back to your device. ### Mode +Defaults to 'Simple'. + +Available Values: + +* `DEFAULT` +* `SIMPLE` operate as an dumb UART tunnel. What goes in will come out, Requires a channel named 'gpio'. +* `PROTO` not implemented yet, but will expose the Protobuf Client API on this serial port +* `TEXTMSG` Will send the string received over the serial port as a Text Message for Display on the other devices. +* `NMEA` Will output a NMEA 0183 Data stream containing the internal GPS or fixed position and other node locations as Waypoints (WPL). + ### Receive GPIO Pin Set the GPIO pin to the RXD pin you have set up. ### Transmit GPIO Pin -Set the GPIO pin to the RXD pin you have set up. +Set the GPIO pin to the TXD pin you have set up. :::tip Connect the TX pin to the other device's RX pin, and vice versa. Connect their grounds to each other (not necessary if they're both plugged into the same USB power source.) @@ -82,9 +92,9 @@ All serial module config options are available in the python CLI. Example comman | :-------------------: | :-----------------: | :-----: | | serial.enabled | `true`, `false` | `false` | | serial.echo | `true`, `false` | `false` | -| serial.mode | `DEFAULT` `SIMPLE` `PROTO` `TEXTMSG` | `DEFAULT` | +| serial.mode | `DEFAULT` `SIMPLE` `PROTO` `TEXTMSG`, `NMEA` | `DEFAULT` | | serial.rxd | GPIO Pin Number 1-39 | Default of `0` is Unset | -| serial.txd | GPIO Pin Number 1-39 | Defaunlt of `0` is Unset | +| serial.txd | GPIO Pin Number 1-33 | Default of `0` is Unset | | serial.baud | `BAUD_DEFAULT` `BAUD_110` `BAUD_300` `BAUD_600` `BAUD_1200` `BAUD_2400` `BAUD_4800` `BAUD_9600` `BAUD_19200` `BAUD_38400` `BAUD_57600` `BAUD_115200` `BAUD_230400` `BAUD_460800` `BAUD_576000` `BAUD_921600` | `BAUD_DEFAULT` | | serial.timeout | `integer` (seconds) | `0` | @@ -105,7 +115,7 @@ meshtastic --set serial.mode PROTO ``` ```shell title="Set RXD to GPIO pin number 7" -meshtastic --set seria.rxd 7 +meshtastic --set serial.rxd 7 ``` ```shell title="Set TXD to GPIO pin number 28" diff --git a/docs/configuration/module-config/telemetry.mdx b/docs/configuration/module-config/telemetry.mdx index 4ce8aa84..64db1b1d 100644 --- a/docs/configuration/module-config/telemetry.mdx +++ b/docs/configuration/module-config/telemetry.mdx @@ -25,7 +25,7 @@ The telemetry module config options are: Device Metrics Update Interval, Environ | INA260 | Current and Voltage | | INA219 | Current and Voltage | | LPS22 | Barometric pressure | -| SHTC3 | Temperature and humidity | +| SHTC3 | Temperature and humidity | ## Module Config Values