From 786248a6b1442af352767af32c1b3896f750c135 Mon Sep 17 00:00:00 2001 From: Aciid <703382+Aciid@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:20:46 +0300 Subject: [PATCH] Dragino TrackerD wip (#2324) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Dragino TrackerD initial variant * fmt --------- Co-authored-by: Thomas Göttgens Co-authored-by: Ben Meadors --- variants/trackerd/platformio.ini | 13 +++++++++ variants/trackerd/variant.h | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 variants/trackerd/platformio.ini create mode 100644 variants/trackerd/variant.h diff --git a/variants/trackerd/platformio.ini b/variants/trackerd/platformio.ini new file mode 100644 index 000000000..23868ffb4 --- /dev/null +++ b/variants/trackerd/platformio.ini @@ -0,0 +1,13 @@ +[env:trackerd] +extends = esp32_base +;platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream +platform = espressif32 +board = pico32 +board_build.f_flash = 80000000L +board_level = extra +build_flags = + ${esp32_base.build_flags} -D PRIVATE_HW -I variants/trackerd -D BSFILE=\"boards/dragino_lbt2.h\" +;board_build.partitions = no_ota.csv +;platform_packages = +; platformio/framework-arduinoespressif32@3 +;platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1-RC1 \ No newline at end of file diff --git a/variants/trackerd/variant.h b/variants/trackerd/variant.h new file mode 100644 index 000000000..b3fca367f --- /dev/null +++ b/variants/trackerd/variant.h @@ -0,0 +1,46 @@ +// Initialize i2c bus on sd_dat and esp_led pins, respectively. We need a bus to not hang on boot +#define HAS_SCREEN 0 +#define I2C_SDA 21 +#define I2C_SCL 22 + +#undef GPS_RX_PIN +#undef GPS_TX_PIN +#define GPS_RX_PIN 9 +#define GPS_TX_PIN 10 + +#define LED_PIN 13 // 13 red, 2 blue, 15 red + +//#define HAS_BUTTON 0 +#define BUTTON_PIN 0 +#define BUTTON_NEED_PULLUP + +#define USE_RF95 +#define LORA_DIO0 26 // a No connect on the SX1262 module +#define LORA_RESET 23 +#define LORA_DIO1 33 +#define LORA_DIO2 32 // Not really used + +#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage + +// Battery +// The battery sense is hooked to pin A0 (4) +// it is defined in the anlaolgue pin section of this file +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +// Definition of milliVolt per LSB => 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096 +#define VBAT_MV_PER_LSB (0.73242188F) +// Voltage divider value => 100K + 100K voltage divider on VBAT = (100K / (100K + 100K)) +#define VBAT_DIVIDER (0.5F) +// Compensation factor for the VBAT divider +#define VBAT_DIVIDER_COMP (2.0) +// Fixed calculation of milliVolt from compensation value +#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER VBAT_DIVIDER_COMP +#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x) + +//#define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity. +//#define ADC_MULTIPLIER 3.3 \ No newline at end of file