@@ -23,7 +23,7 @@ before_install:
|
|||||||
fi
|
fi
|
||||||
- arduino --pref "boardsmanager.additional.urls=" --save-prefs
|
- arduino --pref "boardsmanager.additional.urls=" --save-prefs
|
||||||
install:
|
install:
|
||||||
- arduino --install-library "Adafruit SSD1306","Adafruit GFX Library"
|
- arduino --install-library "U8g2"
|
||||||
script:
|
script:
|
||||||
- cp -f $PWD/crossbow/configurations/config_${CONFIG}.h $PWD/crossbow/config.h &&
|
- cp -f $PWD/crossbow/configurations/config_${CONFIG}.h $PWD/crossbow/config.h &&
|
||||||
arduino --verify --board $BOARD $PWD/crossbow/crossbow.ino
|
arduino --verify --board $BOARD $PWD/crossbow/crossbow.ino
|
||||||
|
|||||||
2
.vscode/arduino.json
vendored
2
.vscode/arduino.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"board": "bsfrance:avr:lora32u4",
|
"board": "bsfrance:avr:lora32u4",
|
||||||
"sketch": "crossbow/crossbow.ino",
|
"sketch": "crossbow/crossbow.ino",
|
||||||
"port": "COM7",
|
"port": "COM5",
|
||||||
"output": "../build"
|
"output": "../build"
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,12 @@ Needs implementation:
|
|||||||
* RX configuration from TX module
|
* RX configuration from TX module
|
||||||
* Sending telemetry from TX to OpenTX radio
|
* Sending telemetry from TX to OpenTX radio
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
To compile, following libraries have to be installed:
|
||||||
|
|
||||||
|
* [U8g2](https://github.com/olikraus/u8g2) for OLED support in TX module
|
||||||
|
|
||||||
# Protocol
|
# Protocol
|
||||||
|
|
||||||
| Byte | Description | Notes |
|
| Byte | Description | Notes |
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
#define FEATURE_TX_INPUT_SBUS
|
#define FEATURE_TX_INPUT_SBUS
|
||||||
|
|
||||||
// #define DEBUG_SERIAL
|
#define DEBUG_SERIAL
|
||||||
// #define DEBUG_PING_PONG
|
// #define DEBUG_PING_PONG
|
||||||
// #define DEBUG_LED
|
// #define DEBUG_LED
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#include "tx_oled.h"
|
#include "tx_oled.h"
|
||||||
|
|
||||||
|
#define OLED_COL_COUNT 16
|
||||||
|
|
||||||
TxOled::TxOled(void) {
|
TxOled::TxOled(void) {
|
||||||
Adafruit_SSD1306 _display(-1);
|
U8X8_SSD1306_128X64_NONAME_HW_I2C _display(U8X8_PIN_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::init() {
|
void TxOled::init() {
|
||||||
_display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
|
_display.begin();
|
||||||
_display.setTextSize(1);
|
_display.setFont(u8x8_font_pxplustandynewtv_f);
|
||||||
_display.setTextColor(WHITE);
|
_display.clear();
|
||||||
_display.clearDisplay();
|
|
||||||
_display.display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::loop() {
|
void TxOled::loop() {
|
||||||
@@ -78,107 +78,79 @@ void TxOled::page(uint8_t page) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::renderPagePwr() {
|
void TxOled::renderPagePwr() {
|
||||||
_display.clearDisplay();
|
char buf[OLED_COL_COUNT];
|
||||||
_display.setTextColor(WHITE, BLACK);
|
|
||||||
|
|
||||||
_display.setCursor(0, 0);
|
_display.clear();
|
||||||
_display.setTextSize(2);
|
_display.draw1x2String(0, 0, "Power");
|
||||||
_display.print("PWR");
|
|
||||||
|
|
||||||
//TODO content
|
snprintf(buf, OLED_COL_COUNT, "%d%s", radioNode.loraTxPower, "dBm");
|
||||||
_display.setCursor(0, 25);
|
_display.draw1x2String(0, 4, buf);
|
||||||
_display.setTextSize(3);
|
|
||||||
_display.print(radioNode.loraTxPower);
|
|
||||||
_display.print("dBm");
|
|
||||||
|
|
||||||
_display.display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::renderPageBind() {
|
void TxOled::renderPageBind() {
|
||||||
_display.clearDisplay();
|
char buf[OLED_COL_COUNT];
|
||||||
_display.setTextColor(WHITE, BLACK);
|
|
||||||
|
|
||||||
_display.setCursor(0, 0);
|
_display.clear();
|
||||||
_display.setTextSize(2);
|
_display.draw1x2String(0, 0, "Bind");
|
||||||
_display.print("Bind");
|
|
||||||
|
|
||||||
//TODO content
|
snprintf(buf, OLED_COL_COUNT, "Bind?");
|
||||||
|
_display.draw1x2String(0, 4, buf);
|
||||||
_display.display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::renderPageMode() {
|
void TxOled::renderPageMode() {
|
||||||
_display.clearDisplay();
|
char buf[OLED_COL_COUNT];
|
||||||
_display.setTextColor(WHITE, BLACK);
|
|
||||||
|
|
||||||
_display.setCursor(0, 0);
|
_display.clear();
|
||||||
_display.setTextSize(2);
|
_display.draw1x2String(0, 0, "Mode");
|
||||||
_display.print("Mode");
|
|
||||||
|
|
||||||
_display.setCursor(0, 25);
|
snprintf(buf, OLED_COL_COUNT, "Full");
|
||||||
_display.setTextSize(3);
|
_display.draw1x2String(0, 4, buf);
|
||||||
_display.print("Full");
|
|
||||||
|
|
||||||
_display.display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::renderPageStats() {
|
void TxOled::renderPageStats() {
|
||||||
_display.clearDisplay();
|
|
||||||
_display.setTextColor(WHITE, BLACK);
|
|
||||||
|
|
||||||
_display.setCursor(0, 0);
|
char buf[OLED_COL_COUNT];
|
||||||
_display.setTextSize(3);
|
|
||||||
_display.print(radioNode.rssi);
|
|
||||||
|
|
||||||
_display.setCursor(18, 28);
|
_display.clear();
|
||||||
_display.setTextSize(2);
|
_display.draw1x2String(0, 0, "Stats");
|
||||||
_display.print(radioNode.snr);
|
|
||||||
|
|
||||||
_display.setCursor(74, 0);
|
_display.drawString(0, 3, "RSSI");
|
||||||
_display.setTextSize(3);
|
_display.drawString(0, 5, "SNR");
|
||||||
_display.print(rxDeviceState.rssi);
|
|
||||||
|
|
||||||
_display.setCursor(92, 28);
|
snprintf(buf, OLED_COL_COUNT, "%d", radioNode.rssi);
|
||||||
_display.setTextSize(2);
|
_display.drawString(6, 3, buf);
|
||||||
_display.print(rxDeviceState.snr);
|
snprintf(buf, OLED_COL_COUNT, "%d", rxDeviceState.rssi);
|
||||||
|
_display.drawString(11, 3, buf);
|
||||||
|
|
||||||
_display.setCursor(54, 48);
|
snprintf(buf, OLED_COL_COUNT, "%d", radioNode.snr);
|
||||||
_display.setTextSize(2);
|
_display.drawString(6, 5, buf);
|
||||||
_display.print(txDeviceState.roundtrip);
|
snprintf(buf, OLED_COL_COUNT, "%d", rxDeviceState.snr);
|
||||||
|
_display.drawString(11, 5, buf);
|
||||||
|
|
||||||
_display.display();
|
snprintf(buf, OLED_COL_COUNT, "Trip: %d", txDeviceState.roundtrip);
|
||||||
|
_display.drawString(0, 7, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TxOled::renderPageInit() {
|
void TxOled::renderPageInit() {
|
||||||
_display.clearDisplay();
|
|
||||||
_display.setTextColor(WHITE, BLACK);
|
|
||||||
_display.setTextSize(2);
|
|
||||||
|
|
||||||
_display.setCursor(0, 0);
|
char buf[OLED_COL_COUNT];
|
||||||
_display.print("Rdy ");
|
|
||||||
_display.print(radioNode.loraTxPower);
|
|
||||||
_display.print("dBm");
|
|
||||||
|
|
||||||
_display.setTextSize(1);
|
_display.clear();
|
||||||
_display.setCursor(0, 32);
|
|
||||||
_display.print("Bandwitdh: ");
|
|
||||||
_display.print(radioNode.loraBandwidth / 1000);
|
|
||||||
_display.print("kHz");
|
|
||||||
|
|
||||||
_display.setCursor(0, 42);
|
snprintf(buf, OLED_COL_COUNT, "Rdy %d %s", radioNode.loraTxPower, "dBm");
|
||||||
_display.print("SF: ");
|
_display.draw1x2String(0, 0, buf);
|
||||||
_display.print(radioNode.loraSpreadingFactor);
|
|
||||||
|
|
||||||
_display.setCursor(64, 42);
|
snprintf(buf, OLED_COL_COUNT, "BW %dkHz", radioNode.loraBandwidth / 1000);
|
||||||
_display.print("CR: ");
|
_display.drawString(0, 4, buf);
|
||||||
_display.print(radioNode.loraCodingRate);
|
|
||||||
|
|
||||||
_display.setCursor(0, 52);
|
snprintf(buf, OLED_COL_COUNT, "SF %d", radioNode.loraSpreadingFactor);
|
||||||
_display.print("Rate: ");
|
_display.drawString(0, 5, buf);
|
||||||
_display.print(1000 / TX_TRANSMIT_SLOT_RATE);
|
|
||||||
_display.print("Hz");
|
|
||||||
|
|
||||||
_display.display();
|
snprintf(buf, OLED_COL_COUNT, "CR %d", radioNode.loraCodingRate);
|
||||||
|
_display.drawString(8, 5, buf);
|
||||||
|
|
||||||
|
snprintf(buf, OLED_COL_COUNT, "Rate: %dHz", 1000 / TX_TRANSMIT_SLOT_RATE);
|
||||||
|
_display.drawString(0, 7, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#ifndef TX_OLED_H
|
#ifndef TX_OLED_H
|
||||||
#define TX_OLED_H
|
#define TX_OLED_H
|
||||||
|
|
||||||
#include <Adafruit_SSD1306.h>
|
|
||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
#include <U8x8lib.h>
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "tactile.h"
|
#include "tactile.h"
|
||||||
#include "radio_node.h"
|
#include "radio_node.h"
|
||||||
@@ -41,7 +41,7 @@ class TxOled {
|
|||||||
void loop();
|
void loop();
|
||||||
void page(uint8_t page);
|
void page(uint8_t page);
|
||||||
private:
|
private:
|
||||||
Adafruit_SSD1306 _display;
|
U8X8_SSD1306_128X64_NONAME_HW_I2C _display;
|
||||||
void renderPageInit();
|
void renderPageInit();
|
||||||
void renderPageStats();
|
void renderPageStats();
|
||||||
void renderPagePwr();
|
void renderPagePwr();
|
||||||
|
|||||||
Reference in New Issue
Block a user