Compare commits

...

33 Commits

Author SHA1 Message Date
US1GHQ 7e7ddb84ab Temporary delete setting for secondary Frequencies
1 year ago
US1GHQ 5ba5e028c5 Example for manual select upload and monitor port
1 year ago
US1GHQ 201cd10a36 Add AXP202X Library
1 year ago
US1GHQ d36d902b1f whoops
1 year ago
US1GHQ e6e4a17c07 Include All dep libs into Lib folder
1 year ago
US1GHQ 633e4d84fa Fix DIGI RX TX
1 year ago
US1GHQ 143fdbe324 Fix start RX mode after TX
1 year ago
US1GHQ 22e45eb083 Set speed and freq working
1 year ago
US1GHQ dfb058dbc9 Init radio changes
1 year ago
US1GHQ c97fd0f611 Full working RX and TX prepare to Final changes
1 year ago
US1GHQ b48740d99e Work RX need correction
1 year ago
US1GHQ 2ad4c0df2e TEST RX
1 year ago
US1GHQ 9fabc58dc2 Add LIB
1 year ago
US1GHQ e6576de2ab Revert "Upload LIB"
1 year ago
US1GHQ 74442ebf12 Upload LIB
1 year ago
US1GHQ 2a46d4d438 Reduce SPI speed for more stability 1W Modules (TEST)
1 year ago
US1GHQ 04a705520e More chnges from DL9SAU
1 year ago
US1GHQ 05abffafe3 BBS support via KISS
1 year ago
US1GHQ 0cae1f75cf Some changes
1 year ago
US1GHQ 0f3df6df71 Some changes
1 year ago
US1GHQ 6f02517eff Disable digi by default
1 year ago
US1GHQ 0ad9aed5d5 Some fixes
1 year ago
US1GHQ 24719c759f Remove code for calculate RSSI and SNR, because we using newest lib of RadioHead
1 year ago
US1GHQ 3fc013ea64 Fix TX PIN for PA LNA
1 year ago
US1GHQ b8a2c5b5d6 Fix ESP32 Working
1 year ago
US1GHQ c0275e1946 Correct BATT READ on the TTGO LoRa v2.1.6
1 year ago
US1GHQ f964289f6d Almost Done
1 year ago
US1GHQ ce8b02cabd Disable SNR Report to KISS
1 year ago
US1GHQ 5fdc8b10bb Fix KISS LIB
1 year ago
US1GHQ 3ae7e9ab89 Changes
1 year ago
US1GHQ 713614ec11 Forgot for ESP32-DEV-V1
1 year ago
US1GHQ b558cc1243 Start add packet mode and other feauters from previous version
1 year ago
US1GHQ d1e51d8039 DIGI_IGATE feauters from dl9sau
1 year ago

@ -4,7 +4,7 @@ Tracker can be used on its own.
You can also connect it via blueetooth with APRSdroid.
After connection with APRX based DIGI it can be used as KISS-TNC
![diagram](http://git.mis.ks.ua/US1GHQ/TTGO-T-Beam-LoRa-APRS/raw/branch/lora-esp32-dev/img/digi-schemat.png)
![diagram](https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS/blob/master/img/digi-schemat.png)
## Contributors
* Initial work: OE1ACM, OE3CJB

@ -39,27 +39,23 @@
</div>
<div class="grid-container full">
<input class="button-primary" type="submit" value="Save">
</div>
</div>
</form>
</article>
</section>
<section>
<div class="grid-container full">
<h2 class="u-full-width">APRS Settings</h2>
</div>
<article>
<div class="grid-container full">
<h2 class="u-full-width">APRS Settings</h2>
</div>
<form action="/save_aprs_cfg" method="post">
<div class="grid-container full">
<h5 class="u-full-width">Transmission Settings</h5>
</div>
<div class="grid-container 3 columns">
<div class="grid-container halves">
<div>
<label for="lora_freq">Frequency [MHz]</label>
<input name="lora_freq" id="lora_freq" type="number" min="144.000" max="928.000" step="0.001" title="LoRa center frequency between 433.001 and 928.000">
</div>
<div>
<label for="txPower">dBm</label>
<input name="txPower" id="txPower" type="number" min="0" max="23" title="LoRa TX Power. Range 0 to 23dBm">
<label for="lora_freq">Main Frequency [MHz]</label>
<input name="lora_freq" id="lora_freq" type="number" min="144.0000" max="928.0000" step="0.0001" title="LoRa center frequency between 144.0001 and 928.0000. I.e. 433.775">
</div>
<div>
<label for="lora_speed">Speed</label>
@ -71,11 +67,42 @@
<option value="210">BW 125khz CR 4:7 SF 12 (209bps)</option>
<option value="180">BW 125khz CR 4:8 SF 12 (183bps)</option>
<option value="610">BW 125khz CR 4:8 SF 10 (610bps)</option>
<option value="1200">BW 125khz CR 4:5 SF 9 (PL,UA, 1200bps)</option>
<option value="1200">BW 125khz CR 4:5 SF 9 (1200bps)</option>
<option value="6000">BW 125khz CR 4:5 SF 7 (BBS, 6000bps)</option>
<option value="21000">BW 500khz CR 4:5 SF 7 (BBS, 21000bps)</option>
</select>
</div>
<div>
<label for="lora_tx_en">Enable LoRa transmitter</label>
<input name="lora_tx_en" id="lora_tx_en" type="checkbox" value="1" title="Allow TX on LoRa. Disable this if you like to prevent TX under all circumstances (i.e. if your tracker is behind an rx-amplifier)">
</div>
<div>
<label for="txPower">TX power [dBm]</label>
<input name="txPower" id="txPower" type="number" min="0" max="23" title="LoRa TX Power. Range 0 to 23dBm">
</div>
<div>
<label for="lora_cradapt">Automatic CodeRate adaption on TX</label>
<input name="lora_cradapt" id="lora_cradapt" type="checkbox" value="1" title="Enable automatic CR adaption. Use this only if you are not a WIDE1 or WIDE2 digi. Still testing, if it behaves good to our network. Currently works only for SF12 modes, because for SF 10 and lower the code for programming CR+SF+BW-combination has not been written yet">
</div>
</div>
<div class="grid-container halves">
<div>
<label for="lora_rssi2p">Add SNR and RSSI to path</label>
<select id="lora_rssi2p" name="lora_rssi2p">
<option value="0">off</option>
<option value="1">To RF during digipeating</option>
<option value="2">To KISS</option>
<option value="4">To APRSIS</option>
<option value="3">To RF and KISS</option>
<option value="5">To RF and APRSIS</option>
<option value="6">To KISS and APRSIS</option>
<option value="7">To RF and KISS and APRSIS</option>
</select>
</div>
<div>
<label for="snraprsis">SNR/RSSI-encoding on kiss: compatible to APRS-IS?</label>
<input name="snraprsis" id="snraprsis" type="checkbox" value=1 title="Add snr+rssi at last digipeater, without digipeated flag. Use this for APRSIS connections. If you have connected a digipeater software to kiss, this option has to be switched off">
</div>
</div>
<div class="grid-container full">
<h5 class="u-full-width">Station Settings</h5>
@ -83,11 +110,11 @@
<div class="grid-container quarters">
<div>
<label for="aprs_callsign">Callsign and SSID</label>
<input class="u-full-width" type="text" minlength="3" name="aprs_callsign" placeholder="NOCALL-1" id="aprs_callsign" title="your callsign with SSID">
<input class="u-full-width" type="text" minlength="3" maxlength="9" name="aprs_callsign" placeholder="NOCALL-1" id="aprs_callsign" title="your callsign with SSID">
</div>
<div>
<label for="aprs_relay_path">Relay Path</label>
<input class="u-full-width" type="text" minlength="0" name="aprs_relay_path" id="aprs_relay_path" title="APRS path, use the shortest as possible, ECHO or WIDE1-1">
<input class="u-full-width" type="text" minlength="0" name="aprs_relay_path" id="aprs_relay_path" title="APRS path, use the shortest as possible, ECHO or WIDE1-1. Only value '1' enables dest-path-digi-notation (like DL9SAU>APRS-1:..) instead of Path ..,WIDE1-1:..">
</div>
<div>
<label for="aprs_s_table">Symbol Table</label>
@ -95,20 +122,24 @@
</div>
<div>
<label for="aprs_symbol">Symbol</label>
<input class="u-full-width" type="text" minlength="1" maxlength="1" name="aprs_symbol" id="aprs_symbol" title="select an icon, for example: [ - jogger, Y - jacht, > - car, b - bike ">
<input class="u-full-width" type="text" minlength="1" maxlength="1" name="aprs_symbol" id="aprs_symbol" title="select an icon, for example: [ - jogger, Y - jacht, > - car, b - bike">
</div>
<div>
<label for="aprs_alt">Show Altitude</label>
<input name="aprs_alt" id="aprs_alt" type="checkbox" value="1" title=" show altitude as frame part">
</div>
</div>
<div>
<label for="show_cmt">Show Comment</label>
<input name="show_cmt" id="show_cmt" type="checkbox" value="1" title=" show comment text">
</div>
</div>
<div>
<label for="aprs_comment">Comment</label>
<input class="u-full-width" type="text" minlength="0" maxlength="64" name="aprs_comment" id="aprs_comment" title=" personal comment">
</div>
<div>
<label for="aprs_comm_rt">Ratelimit adding comment text</label>
<input name="aprs_comm_rt" id="aprs_comm_rt" type="checkbox" value="1" title="If enabled, comment text is sent only every tenth's transmission. Saves airtime.">
</div>
<div>
<label for="aprs_batt">Show Battery</label>
<input name="aprs_batt" id="aprs_batt" type="checkbox" value="1" title=" show battery voltage after personal comment">
@ -124,7 +155,7 @@
</div>
<div>
<label for="tnc_tel_int">Self Telemetry Interval [s]</label>
<input name="tnc_tel_int" id="tnc_tel_int" type="number" min="10" title="time between sending telemetry if Enable Self Telemetry option is selected ">
<input name="tnc_tel_int" id="tnc_tel_int" type="number" min="10" title="time between sending telemetry if Enable Self Telemetry option is selected">
</div>
<div>
<label for="tnc_tel_mic">Self Telemetry Sequence</label>
@ -144,11 +175,11 @@
<div class="grid-container quarters">
<div>
<label for="aprs_fixed_beac">Fixed Beacon</label>
<input name="aprs_fixed_beac" id="aprs_fixed_beac" type="checkbox" value="1" title="enable fixed beacon when GPS is disabled or no fix">
<input name="aprs_fixed_beac" id="aprs_fixed_beac" type="checkbox" value="1" title="enable fixed beacon when GPS is disabled or no fix">
</div>
<div>
<label for="aprs_fb_interv">Fixed Beacon Interval [s]</label>
<input name="aprs_fb_interv" id="aprs_fb_interv" type="number" min="120" title="time between sending a beacon if Fixed Beacon option is selected ">
<input name="aprs_fb_interv" id="aprs_fb_interv" type="number" min="120" title="time between sending a beacon if Fixed Beacon option is selected">
</div>
<div>
<label for="aprs_lat_p">Latitude Preset</label>
@ -165,31 +196,102 @@
<div class="grid-container quarters">
<div>
<label for="sb_min_interv">Min interval [s]</label>
<input name="sb_min_interv" id="sb_min_interv" size="10" type="number" min="10" title="Minimal time for Smart Beaconing">
<input name="sb_min_interv" id="sb_min_interv" type="number" min="10" title="Minimal time for Smart Beaconing">
</div>
<div>
<label for="sb_max_interv">Max interval [s]</label>
<input name="sb_max_interv" id="sb_max_interv" size="10" type="number" min="120" title="Maximal time for Smart Beaconing">
<input name="sb_max_interv" id="sb_max_interv" type="number" min="120" title="Maximal time for Smart Beaconing">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="sb_min_speed">Min speed [km/h]</label>
<input name="sb_min_speed" id="sb_min_speed" size="10" type="number" min="0" title="Minimal speed for Smart Beaconing">
<input name="sb_min_speed" id="sb_min_speed" type="number" min="0" title="Minimal speed for Smart Beaconing">
</div>
<div>
<label for="sb_max_speed">Max speed [km/h]</label>
<input name="sb_max_speed" id="sb_max_speed" size="10" type="number" min="1" title="Maximal speed for Smart Beaconing">
<input name="sb_max_speed" id="sb_max_speed" type="number" min="1" title="Maximal speed for Smart Beaconing">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="sb_angle">Course change [degrees]</label>
<input name="sb_angle" id="sb_angle" size="10" type="number" min="1" max="360" title="Angle of course change to speed up beacon transmission">
<input name="sb_angle" id="sb_angle" type="number" min="5" max="360" title="Angle of course change to speed up beacon transmission. Recommended value: 28">
</div>
<div>
<label for="sb_turn_slope">Turn Slope [degrees]</label>
<input name="sb_turn_slope" id="sb_turn_slope" type="number" min="5" max="255" title="Smart beaconing turn slope. Use 7 for pedestrian, 11 for low/mid speed and 26 for high speed. Recommended value: 26">
</div>
<div>
<label for="sb_turn_time">Turn Time [seconds]</label>
<input name="sb_turn_time" id="sb_turn_time" type="number" min="5", title="Smart beaconing turn time. Wait at least this amount of seconds for next beacon. Recommended value: 30">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="gps_enabled">GPS enabled</label>
<input name="gps_enabled" id="gps_enabled" type="checkbox" value="1" title="enable or disable GPS">
</div>
</div>
<div>
<label for="kiss_myloc_ok">Accept own positions via KISS</label>
<input name="kiss_myloc_ok" id="kiss_myloc_ok" type="checkbox" value="1" title="If set to true, we'll stop sending own position beacons if we heard a position from our call via kiss. Uncheck this, if you like to filter out those positions and keep sending it by this device.">
</div>
<div>
<label for="gps_sleep_ok">Allow GPS sleep while own positions received via KISS</label>
<input name="gps_sleep_ok" id="gps_sleep_ok" type="checkbox" value="1" title="If we have a kiss client like aprsdroid, or a digipeater software, which sends own positions (with same call as ours), we pause sending own positions (neither fixed nor smart beaconing). Uncheck, if you have a display attached and still like to see your current GPS position. This option is only honored if configuration 'Accept own positions via KISS' enabled. Why? If your filter out own positions from and this device sends on it's own, it needs gps running ;)">
</div>
</div>
<div class="grid-container full">
<h6 class="u-full-width">Additional settings for mode DIGIPEATER:<br/>EXPERIMENTAL - USE WITH CARE!</h6>
</div>
<div class="grid-container full">
<div>
<label for="lora_dig_mode">LoRa DIGI Mode</label>
<select id="lora_dig_mode" name="lora_dig_mode">
<option value="0">off. This device does not do any repeating decision.</option>
<option value="1">Repeat if own call is addressed (recommended for normal users). default.</option>
<option value="2">Act as WIDE1 (fill-in) digi</option>
<option value="3">Act as a simple WIDE2 digi (consider to instead attach a real aprs-digipeater software via KISS)</option>
</select>
</div>
</div>
<div class="grid-container full">
<h5 class="u-full-width">APRS-IS settings</h5>
</div>
<div class="grid-container halves">
<div>
<label for="aprsis_en">Enable APRS-IS connection</label>
<input name="aprsis_en" id="aprsis_en" type="checkbox" value="1" title="If we are configured as WIFI client, connet to the APRS-IS net">
</div>
<div>
<label for="aprsis_srv_h">Server Name</label>
<input type="text" name="aprsis_srv_h" id="aprsis_srv_h" title="Server name or IP Address. I.e. euro.aprs2.net">
</div>
<div>
<label for="aprsis_srv_p">TCP Port</label>
<input type="number" name="aprsis_srv_p" id="aprsis_srv_p" min="1" max="65535" title="TCP Port, i.e. 14580">
</div>
<div>
<label for="aprsis_fltr">Filter (optional)</label>
<input type="text" name="aprsis_fltr" id="aprsis_fltr" title="Request server-site filter (may be left empty). See http://www.aprs-is.net/javAPRSFilter.aspx" placeholder="may be left blank">
</div>
<div>
<label for="aprsis_call">Callsign (optional)</label>
<input type="text" name="aprsis_call" id="aprsis_call" minlength="3" maxlength="9" title="Use this callsign for the APRS-IS connection. If not configured, your default callsign is used." placeholder="may be left blank">
</div>
<div>
<label for="aprsis_pw">Password (required)</label>
<input type="password" name="aprsis_pw" id="aprsis_pw" title="Your password for the APRS-IS connection.">
</div>
<div>
<label for="aprsis_2rf">Allow traffic from inet to rf</label>
<input name="aprsis_2rf" id="aprsis_2rf" type="checkbox" value="1" title="Gate APRS-IS traffic to rf (will be encoded in 3rd-party format)">
</div>
<div>
<label for"aprsis_status">Connection status</label>
<input type="text" name="aprsis_status" id="aprsis_status" readonly title="Connection status. Nothing to enter here">
</div>
</div>
<div class="grid-container full">
<div>
<input class="button-primary u-full-width" type="submit" value="Save" title="save settings, remember reboot tracker after save">
@ -208,25 +310,25 @@
<div>
<label for="oled_enabled">OLED Display enabled</label>
<input name="oled_enabled" id="oled_enabled" type="checkbox" value="1" title="Enables or disables OLED">
</div>
</div>
<div>
<label for="bt_enabled">Bluetooth enabled</label>
<input name="bt_enabled" id="bt_enabled" type="checkbox" value="1" title="enable or disable bluetooth">
</div>
</div>
<div>
<label for="led_enable">LED signaling</label>
<input name="led_enable" id="led_enable" type="checkbox" value="1" title="enable or disable LED" DISABLED>
</div>
</div>
<div>
<label for="shutdown_act">Auto power off</label>
<input name="shutdown_act" id="shutdown_act" type="checkbox" value="1" title="activate auto shutdown after usb plug off (not for T-BEAM 0.7)">
</div>
</div>
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="sh_rxtime">Display show RX time [s]</label>
<input name="sh_rxtime" id="sh_rxtime" type="number" min="0" max="45" title="show RX packet for seconds">
</div>
</div>
<div>
<label for="sh_oledtime">Display timeout [s]</label>
<input name="sh_oledtime" id="sh_oledtime" type="number" min="0" max="60" title="Turn OFF OLED after X seconds. Set 0 to disable">
@ -237,16 +339,16 @@
<div>
<label for="shutdown_dt">Auto power off delay [s]</label>
<input name="shutdown_dt" id="shutdown_dt" type="number" min="3" max="3600" title="auto shutdown delay in seconds">
</div>
</div>
</div>
</div>
<div class="grid-container full">
<div>
<input class="button-primary u-full-width" type="submit" value="Save" title="save settings, remember reboot tracker after save">
</div>
</div>
</form>
</form>
</article>
</section>
</section>
<section>
<div class="grid-container full">
<h2 class="u-full-width">Received</h2>
@ -311,12 +413,15 @@
</div>
</form>
</div>
<div class="grid-container full">
Click <a href="/cfg">here</a> to view your configuration.
</div>
</article>
</section>
</div>
<footer>
<center><b>Contributors in order of appearance:</b><br> OE1ACM, OE3CJB, SQ9MDD, SQ5RWU, DJ1AN, M0IGA, SQ5WPR, DO2JMG, SP6VWX, SQ2WB, IU2FRL, DO3BOX, US1GHQ</center>
<center><b>Latest stable version:</b> <a href=https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS>https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS</a></center>
<center><b>Contributors in order of appearance:</b><br> OE1ACM, OE3CJB, SQ9MDD, SQ5RWU, DJ1AN, M0IGA, SQ5WPR, DO2JMG, SP6VWX, SQ2WB, IU2FRL, DO3BOX, DL9SAU</center>
<center><b>Latest stable version:</b> <a href=https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS>https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS</a></center>
<center><b>Licensed under:</b> CC BY-NC-SA</center>
<center><!--VERSION--></center>
</footer>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 148 KiB

@ -10,13 +10,37 @@ extern Preferences preferences;
static const char *const PREF_WIFI_SSID = "wifi_ssid";
static const char *const PREF_WIFI_PASSWORD = "wifi_password";
static const char *const PREF_AP_PASSWORD = "ap_password";
// LoRa settings
static const char *const PREF_LORA_FREQ_PRESET_INIT = "lora_freq_i";
static const char *const PREF_LORA_FREQ_PRESET = "lora_freq";
static const char *const PREF_LORA_SPEED_PRESET_INIT = "lora_speed_i";
static const char *const PREF_LORA_SPEED_PRESET = "lora_speed";
static const char *const PREF_LORA_TX_ENABLE_INIT = "lora_tx_en_i";
static const char *const PREF_LORA_TX_ENABLE = "lora_tx_en";
static const char *const PREF_LORA_TX_POWER_INIT = "txPower_i";
static const char *const PREF_LORA_TX_POWER = "txPower";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET_INIT = "lora_rssi2p_i";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET = "lora_rssi2p";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET_INIT = "snraprsis_i";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET = "snraprsis";
static const char *const PREF_LORA_FREQ_CROSSDIGI_PRESET_INIT = "lora_freq_x_i";
static const char *const PREF_LORA_FREQ_CROSSDIGI_PRESET = "lora_freq_x";
static const char *const PREF_LORA_TX_BEACON_AND_KISS_ON_FREQUENCIES_PRESET_INIT = "tx_qrg_bc_i";
static const char *const PREF_LORA_TX_BEACON_AND_KISS_ON_FREQUENCIES_PRESET = "tx_qrg_bc";
static const char *const PREF_LORA_SPEED_CROSSDIGI_PRESET_INIT = "lora_speed_x_i";
static const char *const PREF_LORA_SPEED_CROSSDIGI_PRESET = "lora_speed_x";
static const char *const PREF_LORA_TX_POWER_CROSSDIGI_PRESET_INIT = "txPower_x_i";
static const char *const PREF_LORA_TX_POWER_CROSSDIGI_PRESET = "txPower_x";
static const char *const PREF_LORA_RX_ON_FREQUENCIES_PRESET_INIT = "rx_qrg_i";
static const char *const PREF_LORA_RX_ON_FREQUENCIES_PRESET = "rx_qrg";
static const char *const PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET_INIT = "lora_cradapt_i";
static const char *const PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET = "lora_cradapt";
static const char *const PREF_APRS_DIGIPEATING_MODE_PRESET_INIT = "lora_dig_mode_i";
static const char *const PREF_APRS_DIGIPEATING_MODE_PRESET = "lora_dig_mode";
static const char *const PREF_APRS_CROSS_DIGIPEATING_MODE_PRESET_INIT = "lora_dig_x_m_i";
static const char *const PREF_APRS_CROSS_DIGIPEATING_MODE_PRESET = "lora_dig_x_m";
// Station settings
static const char *const PREF_APRS_CALLSIGN = "aprs_callsign";
static const char *const PREF_APRS_RELAY_PATH = "aprs_relay_path";
@ -25,6 +49,8 @@ static const char *const PREF_APRS_SYMBOL_TABLE = "aprs_s_table";
static const char *const PREF_APRS_SYMBOL = "aprs_symbol";
static const char *const PREF_APRS_COMMENT = "aprs_comment";
static const char *const PREF_APRS_COMMENT_INIT = "aprs_comm_init";
static const char *const PREF_APRS_COMMENT_RATELIMIT_PRESET = "aprs_comm_rt";
static const char *const PREF_APRS_COMMENT_RATELIMIT_PRESET_INIT = "aprs_comm_rt_i";
static const char *const PREF_APRS_SHOW_ALTITUDE = "aprs_alt";
static const char *const PREF_APRS_SHOW_ALTITUDE_INIT = "aprs_alt_init";
static const char *const PREF_APRS_SHOW_BATTERY = "aprs_batt";
@ -47,6 +73,7 @@ static const char *const PREF_TNC_SELF_TELEMETRY_MIC = "tnc_tel_mic";
static const char *const PREF_TNC_SELF_TELEMETRY_MIC_INIT = "tnc_tel_mic_i";
static const char *const PREF_TNC_SELF_TELEMETRY_PATH = "tnc_tel_path";
static const char *const PREF_TNC_SELF_TELEMETRY_PATH_INIT = "tnc_tel_path_i";
// SMART BEACONING
static const char *const PREF_APRS_SB_MIN_INTERVAL_PRESET = "sb_min_interv";
static const char *const PREF_APRS_SB_MIN_INTERVAL_PRESET_INIT = "sb_min_interv_i";
@ -58,10 +85,18 @@ static const char *const PREF_APRS_SB_MAX_SPEED_PRESET = "sb_max_speed";
static const char *const PREF_APRS_SB_MAX_SPEED_PRESET_INIT = "sb_max_speed_i";
static const char *const PREF_APRS_SB_ANGLE_PRESET = "sb_angle";
static const char *const PREF_APRS_SB_ANGLE_PRESET_INIT = "sb_angle_i";
static const char *const PREF_APRS_SB_TURN_SLOPE_PRESET = "sb_turn_slope";
static const char *const PREF_APRS_SB_TURN_SLOPE_PRESET_INIT = "sb_turn_slope_i";
static const char *const PREF_APRS_SB_TURN_TIME_PRESET = "sb_turn_time";
static const char *const PREF_APRS_SB_TURN_TIME_PRESET_INIT = "sb_turn_time_i";
// Device settings
static const char *const PREF_APRS_GPS_EN = "gps_enabled";
static const char *const PREF_APRS_GPS_EN_INIT = "gps_state_init";
static const char *const PREF_ACCEPT_OWN_POSITION_REPORTS_VIA_KISS = "kiss_myloc_ok";
static const char *const PREF_ACCEPT_OWN_POSITION_REPORTS_VIA_KISS_INIT = "kiss_myloc_ok_i";
static const char *const PREF_GPS_ALLOW_SLEEP_WHILE_KISS = "gps_sleep_ok";
static const char *const PREF_GPS_ALLOW_SLEEP_WHILE_KISS_INIT = "gps_sleep_ok_i";
static const char *const PREF_APRS_SHOW_CMT = "show_cmt";
static const char *const PREF_APRS_SHOW_CMT_INIT = "show_cmt_init";
static const char *const PREF_DEV_BT_EN = "bt_enabled";
@ -77,4 +112,20 @@ static const char *const PREF_DEV_AUTO_SHUT_PRESET_INIT = "shutdown_dtini";
static const char *const PREF_DEV_SHOW_OLED_TIME = "sh_oledtime"; // set OLED timeout
static const char *const PREF_DEV_SHOW_OLED_TIME_INIT = "sh_oledtime_i";
// APRSIS settings
static const char *const PREF_APRSIS_EN_INIT = "aprsis_en_i";
static const char *const PREF_APRSIS_EN = "aprsis_en";
static const char *const PREF_APRSIS_SERVER_NAME_INIT = "aprsis_srv_h_i";
static const char *const PREF_APRSIS_SERVER_NAME = "aprsis_srv_h";
static const char *const PREF_APRSIS_SERVER_PORT_INIT = "aprsis_srv_p_i";
static const char *const PREF_APRSIS_SERVER_PORT = "aprsis_srv_p";
static const char *const PREF_APRSIS_FILTER_INIT = "aprsis_fltr_i";
static const char *const PREF_APRSIS_FILTER = "aprsis_fltr";
static const char *const PREF_APRSIS_CALLSIGN_INIT = "aprsis_call_i";
static const char *const PREF_APRSIS_CALLSIGN = "aprsis_call";
static const char *const PREF_APRSIS_PASSWORD_INIT = "aprsis_pw_i";
static const char *const PREF_APRSIS_PASSWORD = "aprsis_pw";
static const char *const PREF_APRSIS_ALLOW_INET_TO_RF_INIT = "aprsis_2rf_i";
static const char *const PREF_APRSIS_ALLOW_INET_TO_RF = "aprsis_2rf";
#endif

@ -3,13 +3,13 @@
#include <WebServer.h>
#include <ESPmDNS.h>
#include <Update.h>
#include <RH_RF95.h>
#include <RadioLib.h>
#include <esp_wifi.h>
#ifndef TASK_WEBSERVER
#define TASK_WEBSERVER
extern RH_RF95 rf95;
extern SX1278 rf95;
#ifdef KISS_PROTOCOL
extern WiFiServer tncServer;
#endif

@ -1,10 +0,0 @@
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "17"
#endif
#ifndef VERSION
#define VERSION "v0.4.6.17-0a01171 - 2021-12-28 21:20:22.015464"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.4.6.17-0a01171"
#endif

@ -0,0 +1,2 @@
.vscode
.DS_Store

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,22 @@
AXP202X_Library
=====================================
- How to program **AXP20x_Library** with ESP-IDF [ESP_IDF_AXP20x_Library](https://github.com/lewisxhe/ESP_IDF_AXP20x_Library)
- The `setPowerOutPut` function has forced DCDC3 to be turned on and cannot be controlled because T-Watch uses DCDC3 as the esp32 to power the main chip. If it is turned off, the hardware cannot be programmed.
TTGO invests time and resources to provide this open source code, please support TTGO and open source hardware by purchasing products from TTGO!
Written by Lewis He for TTGO. MIT license, all text above must be included in any redistribution
## Chip resource table
| CHIP | AXP173 | AXP192 | AXP202 |
| -------- | ---------------- | ---------------- | ---------------- |
| DC1 | 0v7~3v5 /1200mA | 0v7~3v5 /1200mA | X |
| DC2 | 0v7~2v275/1600mA | 0v7~2v275/1600mA | 0v7~2v275/1600mA |
| DC3 | X | 0v7~3v5 /700mA | 0v7~3v5 /1200mA |
| LDO1 | 3v3 /30mA | 3v3 /30mA | 3v3 /30mA |
| LDO2 | 1v8~3v3 /200mA | 1v8~3v3 /200mA | 1v8~3v3 /200mA |
| LDO3 | 1v8~3v3 /200mA | 1v8~3v3 /200mA | 0v7~3v3 /200mA |
| LDO4 | 0v7~3v5 /500mA | X | 1v8~3v3 /200mA |
| LDO5/IO0 | X | 1v8~3v3 /50mA | 1v8~3v3 /50mA |

@ -0,0 +1,66 @@
/*
MIT License
Copyright (c) 2019 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <Wire.h>
#include <axp20x.h>
AXP20X_Class axp;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
void setup()
{
Serial.begin(115200);
Wire.begin(i2c_sda, i2c_scl);
int ret = axp.begin(Wire);
if (ret == AXP_FAIL) {
Serial.println("AXP Power begin failed");
while (1);
}
//! AXP202 GPIO has no internal pull-up or pull-down.
//! For stability, external pull-up or pull-down resistors are required.
ret = axp.setGPIOMode(AXP_GPIO_0, AXP_IO_INPUT_MODE);
Serial.printf("AXP_GPIO_0 %d\n", ret);
ret = axp.setGPIOMode(AXP_GPIO_1, AXP_IO_INPUT_MODE);
Serial.printf("AXP_GPIO_1 %d\n", ret);
ret = axp.setGPIOMode(AXP_GPIO_2, AXP_IO_INPUT_MODE);
Serial.printf("AXP_GPIO_2 %d\n", ret);
ret = axp.setGPIOMode(AXP_GPIO_3, AXP_IO_INPUT_MODE);
Serial.printf("AXP_GPIO_3 %d\n", ret);
}
void loop()
{
Serial.printf("GPIO: [0]:%d [1]:%d [2]:%d [3]:%d\n",
axp.gpioRead(AXP_GPIO_0),
axp.gpioRead(AXP_GPIO_1),
axp.gpioRead(AXP_GPIO_2),
axp.gpioRead(AXP_GPIO_3)
);
delay(1000);
}

@ -0,0 +1,63 @@
/*
MIT License
Copyright (c) 2019 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <Wire.h>
#include <axp20x.h>
AXP20X_Class axp;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
void setup()
{
Serial.begin(115200);
Wire.begin(i2c_sda, i2c_scl);
int ret = axp.begin(Wire);
if (ret == AXP_FAIL) {
Serial.println("AXP Power begin failed");
while (1);
}
axp.setGPIOMode(AXP_GPIO_0, AXP_IO_OUTPUT_HIGH_MODE);
axp.setGPIOMode(AXP_GPIO_1, AXP_IO_OUTPUT_HIGH_MODE);
//! GPIO2, GPIO3 is only allowed to be configured to output low
axp.gpioWrite(AXP_GPIO_2, LOW);
axp.gpioWrite(AXP_GPIO_3, LOW);
}
void loop()
{
//! GPIO0, GPIO1 allows output high and low
axp.gpioWrite(AXP_GPIO_0, HIGH);
axp.gpioWrite(AXP_GPIO_1, HIGH);
delay(1000);
axp.gpioWrite(AXP_GPIO_0, LOW);
axp.gpioWrite(AXP_GPIO_1, LOW);
delay(1000);
}

@ -0,0 +1,87 @@
/*
MIT License
Copyright (c) 2019 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <Wire.h>
#include <axp20x.h>
AXP20X_Class axp;
bool axpIrq = 0;
uint8_t second = 0;
uint32_t timer = 0;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
const uint8_t axp_irq_pin = 35;
void setup()
{
Serial.begin(115200);
Wire.begin(i2c_sda, i2c_scl);
int ret = axp.begin(Wire);
if (ret == AXP_FAIL) {
Serial.println("AXP Power begin failed");
while (1);
}
//! enable timer irq and pek key press irq channel
axp.enableIRQ(AXP202_TIMER_TIMEOUT_IRQ | AXP202_PEK_SHORTPRESS_IRQ, true);
//! attachInterrupt to gpio 35
pinMode(axp_irq_pin, INPUT);
attachInterrupt(axp_irq_pin, [] {
axpIrq = 1;
}, FALLING);
axp.clearIRQ();
axp.setTimer(1);
}
void loop()
{
if (millis() - timer > 1000) {
second++;
Serial.printf("%u second\n", second);
timer = millis();
}
if (axpIrq) {
axpIrq = 0;
axp.readIRQ();
if (axp.isPEKShortPressIRQ()) {
Serial.printf("AXP202 PEK key Click\n");
}
if (axp.isTimerTimeoutIRQ()) {
Serial.printf("AXP202 timer timeout\n");
axp.clearTimerStatus();
while (1) {
delay(100);
}
}
axp.clearIRQ();
}
}

@ -0,0 +1,153 @@
/*
MIT License
Copyright (c) 2019 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "axp20x.h"
AXP20X_Class axp;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
const uint8_t slave_address = AXP192_SLAVE_ADDRESS; //use axp192
// const uint8_t slave_address = AXP202_SLAVE_ADDRESS; //use axp202
void printPowerChannel();
void setup(void)
{
Serial.begin(115200);
Wire.begin(i2c_sda, i2c_scl);
Serial.println("AXP192/AXP202 ADC Test");
/* Initialise the pmu */
int ret = axp.begin(Wire, slave_address);
if (ret) {
/* There was a problem detecting the AXP202/192 ... check your connections */
Serial.println("Ooops, AXP202/AXP192 power chip detected ... Check your wiring!");
while (1);
}
/*Enable AXP ADC function*/
axp.adc1Enable(AXP202_VBUS_VOL_ADC1 |
AXP202_VBUS_CUR_ADC1 |
AXP202_BATT_CUR_ADC1 |
AXP202_BATT_VOL_ADC1,
true);
Serial.println("");
printPowerChannel();
}
void loop(void)
{
Serial.println("=========================");
Serial.print("VBUS STATUS: ");
// You can use isVBUSPlug to check whether the USB connection is normal
if (axp.isVBUSPlug()) {
Serial.println("CONNECT");
// Get USB voltage
Serial.print("VBUS Volate:");
Serial.print(axp.getVbusVoltage());
Serial.println(" mV");
// Get USB current
Serial.print("VBUS Current: ");
Serial.print(axp.getVbusCurrent());
Serial.println(" mA");
} else {
Serial.println("DISCONNECT");
}
Serial.println("=========================");
Serial.print("BATTERY STATUS: ");
// You can use isBatteryConnect() to check whether the battery is connected properly
if (axp.isBatteryConnect()) {
Serial.println("CONNECT");
// Get battery voltage
Serial.print("BAT Volate:");
Serial.print(axp.getBattVoltage());
Serial.println(" mV");
// To display the charging status, you must first discharge the battery,
// and it is impossible to read the full charge when it is fully charged
if (axp.isChargeing()) {
Serial.print("Charge:");
Serial.print(axp.getBattChargeCurrent());
Serial.println(" mA");
} else {
// Show current consumption
Serial.print("Discharge:");
Serial.print(axp.getBattDischargeCurrent());
Serial.println(" mA");
/*getBattPercentage just only support axp202 */
if (slave_address == AXP202_SLAVE_ADDRESS) {
Serial.print("Per: ");
Serial.print(axp.getBattPercentage());
Serial.println(" %");
}
}
} else {
Serial.println("DISCONNECT");
}
Serial.println();
Serial.println();
delay(3000);
}
void printPowerChannel()
{
Serial.print("DC2:");
Serial.print(axp.isDCDC2Enable() ? String(axp.getDCDC2Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("DC3:");
Serial.print(axp.isDCDC3Enable() ? String(axp.getDCDC3Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("LDO2:");
Serial.print(axp.isLDO2Enable() ? String(axp.getLDO2Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("LDO3:");
Serial.print(axp.isLDO3Enable() ? String(axp.getLDO3Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("LDO4:");
Serial.print(axp.isLDO4Enable() ? "ENABLE" : "DISABLE");
Serial.print(" ");
Serial.print("Exten:");
Serial.print(axp.isExtenEnable() ? "ENABLE" : "DISABLE");
Serial.print("\r\n");
}

@ -0,0 +1,231 @@
/*
MIT License
Copyright (c) 2019 lewis he
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <Wire.h>
#include <axp20x.h>
AXP20X_Class axp;
bool axpIrq = 0;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
const uint8_t axp_irq_pin = 35;
void setFlag(void)
{
axpIrq = true;
}
void setup()
{
Serial.begin(115200);
Wire.begin(i2c_sda, i2c_scl);
//! Use the Wire port
int ret = axp.begin(Wire, AXP192_SLAVE_ADDRESS);
// int ret = axp.begin(Wire);
if (ret == AXP_FAIL) {
Serial.println("AXP Power begin failed");
while (1);
}
Serial.println();
axp.setVWarningLevel1(3450);
axp.setVWarningLevel2(3400);
uint16_t level1 = axp.getVWarningLevel1();
uint16_t level2 = axp.getVWarningLevel2();
Serial.printf("getVWarningLevel1:%u mV \n", level1 );
Serial.printf("getVWarningLevel2:%u mV \n", level2);
Serial.printf("getPowerDonwVoltage:%u mV \n", axp.getPowerDownVoltage());
axp.setPowerDownVoltage(2600);
Serial.printf("getPowerDonwVoltage:%u mV \n", axp.getPowerDownVoltage());
Serial.println();
//! attachInterrupt to gpio 35
pinMode(axp_irq_pin, INPUT_PULLUP);
attachInterrupt(axp_irq_pin, setFlag, FALLING);
axp.clearIRQ();
//! enable all irq channel
axp.enableIRQ(AXP202_ALL_IRQ, true);
axp.setPowerOutPut(AXP202_DCDC3, AXP202_ON);
axp.setPowerOutPut(AXP202_EXTEN, AXP202_ON);
axp.setPowerOutPut(AXP202_LDO2, AXP202_ON);
axp.setPowerOutPut(AXP202_LDO4, AXP202_ON);
axp.setPowerOutPut(AXP202_DCDC2, AXP202_ON);
axp.setLDO4Voltage(AXP202_LDO4_3300MV);
axp.setLDO3Voltage(3500);
axp.setPowerOutPut(AXP202_LDO3, AXP202_ON);
Serial.print("DC2:");
Serial.print(axp.isDCDC2Enable() ? String(axp.getDCDC2Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("DC3:");
Serial.print(axp.isDCDC3Enable() ? String(axp.getDCDC3Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("LDO2:");
Serial.print(axp.isLDO2Enable() ? String(axp.getLDO2Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("LDO3:");
Serial.print(axp.isLDO3Enable() ? String(axp.getLDO3Voltage()) + " mv" : "DISABLE");
Serial.print(" ");
Serial.print("LDO4:");
Serial.print(axp.isLDO4Enable() ? "ENABLE" : "DISABLE");
Serial.print(" ");
Serial.print("Exten:");
Serial.print(axp.isExtenEnable() ? "ENABLE" : "DISABLE");
Serial.print("\r\n");
axp.setTimer(1);
}
void loop()
{
if (axpIrq) {
axpIrq = 0;
axp.readIRQ();
Serial.println("axp20x irq enter!");
if (axp.isAcinOverVoltageIRQ()) {
Serial.printf("isAcinOverVoltageIRQ\n");
}
if (axp.isAcinPlugInIRQ()) {
Serial.printf("isAcinPlugInIRQ\n");
}
if (axp.isAcinRemoveIRQ()) {
Serial.printf("isAcinRemoveIRQ\n");
}
if (axp.isVbusOverVoltageIRQ()) {
Serial.printf("isVbusOverVoltageIRQ\n");
}
if (axp.isVbusPlugInIRQ()) {
Serial.printf("isVbusPlugInIRQ\n");
}
if (axp.isVbusRemoveIRQ()) {
Serial.printf("isVbusRemoveIRQ\n");
}
if (axp.isVbusLowVHOLDIRQ()) {
Serial.printf("isVbusLowVHOLDIRQ\n");
}
if (axp.isBattPlugInIRQ()) {
Serial.printf("isBattPlugInIRQ\n");
}
if (axp.isBattRemoveIRQ()) {
Serial.printf("isBattRemoveIRQ\n");
}
if (axp.isBattEnterActivateIRQ()) {
Serial.printf("isBattEnterActivateIRQ\n");
}
if (axp.isBattExitActivateIRQ()) {
Serial.printf("isBattExitActivateIRQ\n");
}
if (axp.isChargingIRQ()) {
Serial.printf("isChargingIRQ\n");
}
if (axp.isChargingDoneIRQ()) {
Serial.printf("isChargingDoneIRQ\n");
}
if (axp.isBattTempLowIRQ()) {
Serial.printf("isBattTempLowIRQ\n");
}
if (axp.isBattTempHighIRQ()) {
Serial.printf("isBattTempHighIRQ\n");
}
if (axp.isChipOvertemperatureIRQ()) {
Serial.printf("isChipOvertemperatureIRQ\n");
}
if (axp.isChargingCurrentLessIRQ()) {
Serial.printf("isChargingCurrentLessIRQ\n");
}
if (axp.isDC2VoltageLessIRQ()) {
Serial.printf("isDC2VoltageLessIRQ\n");
}
if (axp.isDC3VoltageLessIRQ()) {
Serial.printf("isDC3VoltageLessIRQ\n");
}
if (axp.isLDO3VoltageLessIRQ()) {
Serial.printf("isLDO3VoltageLessIRQ\n");
}
if (axp.isPEKShortPressIRQ()) {
Serial.printf("isPEKShortPressIRQ\n");
}
if (axp.isPEKLongtPressIRQ()) {
Serial.printf("isPEKLongtPressIRQ\n");
}
if (axp.isNOEPowerOnIRQ()) {
Serial.printf("isNOEPowerOnIRQ\n");
}
if (axp.isNOEPowerDownIRQ()) {
Serial.printf("isNOEPowerDownIRQ\n");
}
if (axp.isVBUSEffectiveIRQ()) {
Serial.printf("isVBUSEffectiveIRQ\n");
}
if (axp.isVBUSInvalidIRQ()) {
Serial.printf("isVBUSInvalidIRQ\n");
}
if (axp.isVUBSSessionIRQ()) {
Serial.printf("isVUBSSessionIRQ\n");
}
if (axp.isVUBSSessionEndIRQ()) {
Serial.printf("isVUBSSessionEndIRQ\n");
}
if (axp.isLowVoltageLevel1IRQ()) {
Serial.printf("isLowVoltageLevel1IRQ\n");
}
if (axp.isLowVoltageLevel2IRQ()) {
Serial.printf("isLowVoltageLevel2IRQ\n");
}
if (axp.isTimerTimeoutIRQ()) {
Serial.printf("isTimerTimeoutIRQ\n");
axp.offTimer();
axp.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
}
if (axp.isPEKRisingEdgeIRQ()) {
Serial.printf("isPEKRisingEdgeIRQ\n");
}
if (axp.isPEKFallingEdgeIRQ()) {
Serial.printf("isPEKFallingEdgeIRQ\n");
}
if (axp.isGPIO3InputEdgeTriggerIRQ()) {
Serial.printf("isGPIO3InputEdgeTriggerIRQ\n");
}
if (axp.isGPIO2InputEdgeTriggerIRQ()) {
Serial.printf("isGPIO2InputEdgeTriggerIRQ\n");
}
if (axp.isGPIO1InputEdgeTriggerIRQ()) {
Serial.printf("isGPIO1InputEdgeTriggerIRQ\n");
}
if (axp.isGPIO0InputEdgeTriggerIRQ()) {
Serial.printf("isGPIO0InputEdgeTriggerIRQ\n");
}
axp.clearIRQ();
}
}

@ -0,0 +1,44 @@
#include <Wire.h>
#include <axp20x.h>
AXP20X_Class axp;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
void setup()
{
Serial.begin(115200);
delay(3000);
Wire.begin(i2c_sda, i2c_scl);
int ret = axp.begin(Wire);
if (ret == AXP_FAIL) {
Serial.println("AXP Power begin failed");
while (1);
}
int cur = axp.getChargeControlCur();
Serial.printf("Current charge control current = %d mA \n", cur);
//axp202 allows maximum charging current of 1800mA, minimum 300mA
axp.setChargeControlCur(500);
Serial.printf("Set charge control current 500 mA \n");
//When the chip is axp192 / 173, the allowed values are 0 ~ 15,
//corresponding to the axp1xx_charge_current_t enumeration
// axp.setChargeControlCur(AXP1XX_CHARGE_CUR_550MA);
// Serial.printf("Set charge control current 550 mA \n");
cur = axp.getChargeControlCur();
Serial.printf("Current charge control current = %d mA \n", cur);
}
void loop()
{
}

@ -0,0 +1,115 @@
#include <Wire.h>
#include <axp20x.h>
AXP20X_Class axp;
const uint8_t i2c_sda = 21;
const uint8_t i2c_scl = 22;
const uint8_t irq_pin = 35;
bool pmu_irq = false;
void sleepPMU()
{
int ret;
// PEK or GPIO edge wake-up function enable setting in Sleep mode
do {
// In order to ensure that it is set correctly,
// the loop waits for it to return the correct return value
Serial.println("Set PMU in sleep mode");
ret = axp.setSleep();
delay(500);
} while (ret != AXP_PASS) ;
// Turn off all power channels, only use PEK or AXP GPIO to wake up
// After setting AXP202/AXP192 to sleep,
// it will start to record the status of the power channel that was turned off after setting,
// it will restore the previously set state after PEK button or GPIO wake up
// Turn off all AXP192 power channels
ret = axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
Serial.printf("Set Power AXP192_LDO2:%s\n", ret == AXP_PASS ? "OK" : "FAIL");