|
| 1 | +import React, { FunctionComponent, memo } from 'react'; |
| 2 | +import { makeStyles, Tooltip } from '@material-ui/core'; |
| 3 | +import QuestionIcon from '@material-ui/icons/Help'; |
| 4 | +import { UserDefineKey } from '../../gql/generated/types'; |
| 5 | + |
| 6 | +const useStyles = makeStyles(() => ({ |
| 7 | + root: { |
| 8 | + display: 'inline-block', |
| 9 | + }, |
| 10 | + tooltipRoot: { |
| 11 | + maxWidth: '400px', |
| 12 | + }, |
| 13 | + tooltipRootBig: { |
| 14 | + maxWidth: '700px', |
| 15 | + }, |
| 16 | + tooltip: { |
| 17 | + paddingLeft: '1em', |
| 18 | + paddingRight: '1em', |
| 19 | + fontSize: '1.4em !important', |
| 20 | + '& a': { |
| 21 | + color: '#90caf9', |
| 22 | + }, |
| 23 | + }, |
| 24 | + icon: { |
| 25 | + verticalAlign: 'middle', |
| 26 | + marginLeft: '5px', |
| 27 | + fontSize: '1.44em', |
| 28 | + }, |
| 29 | +})); |
| 30 | + |
| 31 | +interface UserDefineDescriptionProps { |
| 32 | + userDefine: UserDefineKey; |
| 33 | +} |
| 34 | + |
| 35 | +const UserDefineDescription: FunctionComponent<UserDefineDescriptionProps> = memo( |
| 36 | + ({ userDefine }) => { |
| 37 | + const styles = useStyles(); |
| 38 | + const toText = (key: UserDefineKey) => { |
| 39 | + switch (key) { |
| 40 | + case UserDefineKey.REGULATORY_DOMAIN_AU_433: |
| 41 | + return ''; |
| 42 | + case UserDefineKey.REGULATORY_DOMAIN_AU_915: |
| 43 | + return ''; |
| 44 | + case UserDefineKey.REGULATORY_DOMAIN_EU_433: |
| 45 | + return ''; |
| 46 | + case UserDefineKey.REGULATORY_DOMAIN_EU_868: |
| 47 | + return ''; |
| 48 | + case UserDefineKey.REGULATORY_DOMAIN_FCC_915: |
| 49 | + return ''; |
| 50 | + case UserDefineKey.REGULATORY_DOMAIN_ISM_2400: |
| 51 | + return ''; |
| 52 | + case UserDefineKey.BINDING_PHRASE: |
| 53 | + return ( |
| 54 | + <p> |
| 55 | + Both the TX and RX NEED to have the same binding phrase or |
| 56 | + ExpressLRS will not work. Set something memorable, and limit to |
| 57 | + alphanumeric phrases conforming to the Latin alphabet. This phrase |
| 58 | + gets MD5 hashed and gets built into the binary you will be |
| 59 | + flashing. |
| 60 | + </p> |
| 61 | + ); |
| 62 | + case UserDefineKey.ARM_CHANNEL: |
| 63 | + return ( |
| 64 | + <div> |
| 65 | + <p>ARM channels</p> |
| 66 | + <p> |
| 67 | + AUX1 - Channel 5<br /> |
| 68 | + AUX2 - Channel 6<br /> |
| 69 | + AUX3 - Channel 7<br /> |
| 70 | + AUX4 - Channel 8<br /> |
| 71 | + AUX5 - Channel 9<br /> |
| 72 | + AUX6 - Channel 10 |
| 73 | + <br /> |
| 74 | + AUX7 - Channel 11 |
| 75 | + <br /> |
| 76 | + AUX8 - Channel 12 |
| 77 | + </p> |
| 78 | + </div> |
| 79 | + ); |
| 80 | + case UserDefineKey.AUTO_WIFI_ON_BOOT: |
| 81 | + return ( |
| 82 | + <p> |
| 83 | + This will automatically turn the wifi on for any module that has |
| 84 | + an ESP8285 on it if no connection is found after ~10 seconds from |
| 85 | + boot. This enables pushing firmware updates to the RX by |
| 86 | + connecting to its wifi network and visiting 192.168.4.1 |
| 87 | + </p> |
| 88 | + ); |
| 89 | + case UserDefineKey.FAST_SYNC: |
| 90 | + return <p>Experimental option that adds faster initial syncing.</p>; |
| 91 | + case UserDefineKey.FEATURE_OPENTX_SYNC: |
| 92 | + return ( |
| 93 | + <p> |
| 94 | + This option lowers latency and should be kept enabled. This option |
| 95 | + requires OpenTX 2.4 or above |
| 96 | + </p> |
| 97 | + ); |
| 98 | + case UserDefineKey.FEATURE_OPENTX_SYNC_AUTOTUNE: |
| 99 | + return ( |
| 100 | + <p> |
| 101 | + This option is more experimental and can lower the offset from the |
| 102 | + radio by tuning it as close as possible to 0. This option requires |
| 103 | + OpenTX 2.4 or above |
| 104 | + </p> |
| 105 | + ); |
| 106 | + case UserDefineKey.HYBRID_SWITCHES_8: |
| 107 | + return ( |
| 108 | + <div> |
| 109 | + <p> |
| 110 | + NB The switch mode MUST match on the transmitter and all |
| 111 | + receivers that you use with it. Do not mix switch modes. Older |
| 112 | + versions of the firmware (prior to November 30th 2020) dit not |
| 113 | + check to make sure the transmitter and receiver are using the |
| 114 | + same mode, so the switch positions could be misinterpreted |
| 115 | + leading to unexpected behaviour, possibly including |
| 116 | + unintentional arming. Current versions include a check that |
| 117 | + should prevent receivers and transmitters with different switch |
| 118 | + settings from establishing a link, but it is still recommended |
| 119 | + to pick one switch mode and use it for all your transmitters and |
| 120 | + receivers. |
| 121 | + </p> |
| 122 | + <p>There are 2 available choices here.</p> |
| 123 | + |
| 124 | + <ol> |
| 125 | + <li> |
| 126 | + The default choice is to have 4 1bit switches (which |
| 127 | + corresponds to 2 position switches). |
| 128 | + </li> |
| 129 | + <li> |
| 130 | + The other option is DHYBRID_SWITCHES_8 where the first switch |
| 131 | + is treated as a low-latency switch to be used for arm/disarm. |
| 132 | + It is sent with every packet. For the remaining 7 switches the |
| 133 | + first 3 bits are the switch ID, followed by 2 bits for the |
| 134 | + switch value. Switches that have changed are given priority, |
| 135 | + otherwise each switch value is sent in a round-robin. All |
| 136 | + switches are encoded for 3 position support. All analog |
| 137 | + channels are reduced to 10 bit resolution to free up space in |
| 138 | + the RC packet for switches. For all use cases besides absolute |
| 139 | + speed we recommend using hybrid switches over sequential or |
| 140 | + 1-bit switches. The only "downside" is the reduced |
| 141 | + channel resolution, but that turns out to not be important |
| 142 | + because Betaflight only interprets channels as 10bit, so no |
| 143 | + resolution is actually lost. |
| 144 | + </li> |
| 145 | + </ol> |
| 146 | + </div> |
| 147 | + ); |
| 148 | + case UserDefineKey.LOCK_ON_FIRST_CONNECTION: |
| 149 | + return ( |
| 150 | + <p> |
| 151 | + RF Mode Locking - Default mode is for the RX to cycle through the |
| 152 | + available RF modes with 5s pauses going from highest to lowest |
| 153 | + mode and finding which mode the Tx transmitting. This allows the |
| 154 | + RX to cycle, but once a connection has been established, the Rx |
| 155 | + will no longer cycle through the RF modes (until it receives a |
| 156 | + power reset). |
| 157 | + </p> |
| 158 | + ); |
| 159 | + case UserDefineKey.LOCK_ON_50HZ: |
| 160 | + return ( |
| 161 | + <p> |
| 162 | + This locks the RX at 50Hz mode from the power-up. Only recommended |
| 163 | + for longrange, and partly redundant with LOCK_ON_FIRST_CONNECTION. |
| 164 | + </p> |
| 165 | + ); |
| 166 | + case UserDefineKey.JUST_BEEP_ONCE: |
| 167 | + return ( |
| 168 | + <p> |
| 169 | + This sets if the TX only beeps one-time versus playing a startup |
| 170 | + song. |
| 171 | + </p> |
| 172 | + ); |
| 173 | + case UserDefineKey.MY_STARTUP_MELODY: |
| 174 | + return ( |
| 175 | + <div> |
| 176 | + <p> |
| 177 | + Use this to define your own startup melody using the BlHeli32 |
| 178 | + syntax. The parameters music string and bpm are required, |
| 179 | + whereas semitone offset is optional to transpose the entire |
| 180 | + melody up or down by the defined amount of semitones. Example |
| 181 | + BlHeli32 melodies are available on{' '} |
| 182 | + <a |
| 183 | + target="_blank" |
| 184 | + rel="noreferrer noreferrer" |
| 185 | + href="https://www.youtube.com/playlist?list=PL_O0XT_1mZinetucKyuBUvkju8P7DEg-v" |
| 186 | + > |
| 187 | + Rox Wolfs youtube channel |
| 188 | + </a> |
| 189 | + , some experimentation may be required though. |
| 190 | + </p> |
| 191 | + <p> |
| 192 | + To write your own melody,{' '} |
| 193 | + <a |
| 194 | + target="_blank" |
| 195 | + rel="noreferrer noreferrer" |
| 196 | + href="https://github.com/nseidle/AxelF_DoorBell/wiki/How-to-convert-sheet-music-into-an-Arduino-Sketch" |
| 197 | + > |
| 198 | + Sheet Music 101 |
| 199 | + </a>{' '} |
| 200 | + and this{' '} |
| 201 | + <a |
| 202 | + target="_blank" |
| 203 | + rel="noreferrer noreferrer" |
| 204 | + href="https://dra6n.github.io/blhelikeyboard.github.io/" |
| 205 | + > |
| 206 | + BLHeli Piano |
| 207 | + </a>{' '} |
| 208 | + are useful resources. |
| 209 | + </p> |
| 210 | + </div> |
| 211 | + ); |
| 212 | + case UserDefineKey.NO_SYNC_ON_ARM: |
| 213 | + return ( |
| 214 | + <p> |
| 215 | + Do not transmit sync packets while armed. If you are using a |
| 216 | + different channel than the default you need to edit (or you may |
| 217 | + not be able to gain sync safely - default is listed in ARM_CHANNEL |
| 218 | + as AUX1 which is Channel 5). This is useful for racing as there is |
| 219 | + less time & packets wasted on sending sync packets. HOWEVER if you |
| 220 | + are doing serious long range, keep this turned off because in the |
| 221 | + case of a sustained failsafe, link can not be regained while |
| 222 | + armed. |
| 223 | + </p> |
| 224 | + ); |
| 225 | + case UserDefineKey.R9M_UNLOCK_HIGHER_POWER: |
| 226 | + return ( |
| 227 | + <div> |
| 228 | + <p> |
| 229 | + There has been some reports of the R9M modules showing |
| 230 | + instability at > 250mw with stock cooling. This in part |
| 231 | + because the ELRS uses a higher duty cycle for transmission |
| 232 | + compared to stock firmware. By default the power is limited to |
| 233 | + 250mw. You can unlock up to 1000mw by enabling the following |
| 234 | + option. Do this at your own risk if you make no cooling |
| 235 | + modifications. |
| 236 | + </p> |
| 237 | + <p> |
| 238 | + We published{' '} |
| 239 | + <a |
| 240 | + target="_blank" |
| 241 | + rel="noreferrer noreferrer" |
| 242 | + href="https://github.com/AlessandroAU/ExpressLRS/wiki/R9M-Fan-Mod-Cover" |
| 243 | + > |
| 244 | + R9M Fan Mod Cover |
| 245 | + </a> |
| 246 | + , a custom 3d printed backplate with room for a fan and extra |
| 247 | + cooling to allow for maximum power (1-2W depending on the mod). |
| 248 | + </p> |
| 249 | + </div> |
| 250 | + ); |
| 251 | + case UserDefineKey.UART_INVERTED: |
| 252 | + return ( |
| 253 | + <p> |
| 254 | + Enables compatibility with radios that output inverted CRSF, such |
| 255 | + as the T8SG V2. |
| 256 | + </p> |
| 257 | + ); |
| 258 | + case UserDefineKey.USE_500HZ: |
| 259 | + return ( |
| 260 | + <p> |
| 261 | + Enables 500Hz mode. Requires the ELRS Fork of OTX (2.3.10 |
| 262 | + Currently) to work properly. |
| 263 | + </p> |
| 264 | + ); |
| 265 | + case UserDefineKey.USE_ESP8266_BACKPACK: |
| 266 | + return ( |
| 267 | + <p> |
| 268 | + This enables communication with the ESP Backpack for over-the-air |
| 269 | + updates (DeviceTarget: FrSky_TX_R9M_via_WiFi) 🖥️ and debugging via |
| 270 | + WebSocket 🔍 |
| 271 | + </p> |
| 272 | + ); |
| 273 | + case UserDefineKey.USE_R9MM_R9MINI_SBUS: |
| 274 | + return ( |
| 275 | + <p> |
| 276 | + This is useful for F4 FCs which do not have an uninverted UART |
| 277 | + option. This is only one way, so you lose the telemetry downlink |
| 278 | + to your radio as well as passthrough flashing. This will output |
| 279 | + out of the default S.BUS pin on your R9MM/R9Mini. set |
| 280 | + serialrx_inverted = ON may also be needed within Betaflight for |
| 281 | + compatibility |
| 282 | + </p> |
| 283 | + ); |
| 284 | + case UserDefineKey.USE_UART2: |
| 285 | + return ( |
| 286 | + <p> |
| 287 | + This enables integration with Jye's{' '} |
| 288 | + <a |
| 289 | + target="_blank" |
| 290 | + rel="noreferrer noreferrer" |
| 291 | + href="https://github.com/JyeSmith/FENIX-rx5808-pro-diversity" |
| 292 | + > |
| 293 | + FENIX rx5805 pro-diversity module |
| 294 | + </a> |
| 295 | + </p> |
| 296 | + ); |
| 297 | + default: |
| 298 | + return ''; |
| 299 | + } |
| 300 | + }; |
| 301 | + const desc = toText(userDefine); |
| 302 | + return ( |
| 303 | + <div className={styles.root}> |
| 304 | + {desc !== '' && ( |
| 305 | + <Tooltip |
| 306 | + placement="top" |
| 307 | + arrow |
| 308 | + classes={{ |
| 309 | + tooltip: |
| 310 | + userDefine === UserDefineKey.HYBRID_SWITCHES_8 |
| 311 | + ? styles.tooltipRootBig |
| 312 | + : styles.tooltipRoot, |
| 313 | + }} |
| 314 | + title={<div className={styles.tooltip}>{desc}</div>} |
| 315 | + > |
| 316 | + <QuestionIcon className={styles.icon} /> |
| 317 | + </Tooltip> |
| 318 | + )} |
| 319 | + </div> |
| 320 | + ); |
| 321 | + } |
| 322 | +); |
| 323 | + |
| 324 | +export default UserDefineDescription; |
0 commit comments