Browse Source

Added ruby extra buttons

master
Englebert 7 months ago
parent
commit
c3f1f81311
  1. 25
      src/main.cpp
  2. 3
      src/main.h

25
src/main.cpp

@ -189,7 +189,7 @@ void taskDisplay(void *pvParameters) {
}
char msg[64];
sprintf(msg, "I2C Packets: %d\n", i2c_counter);
sprintf(msg, "I2C Packets: %d\r\n", i2c_counter);
Serial.print(msg);
/***
@ -627,6 +627,9 @@ void parse_i2c_command(void) {
for(uint8_t i = 0; i < 8; i++)
rubybutton[i] = 0;
// REF:
// https://rubyfpv.com/development_extensions.php
// MENU
if((uint32_t)(millis() - rubybutton_last[0]) > rubybutton_delay) {
rubybutton[0] = incomingReadings.rubybutton & 0x01;
@ -655,11 +658,29 @@ void parse_i2c_command(void) {
rubybutton_last[3] = millis();
}
// QA1 - YAW LEFT
if((uint32_t)(millis() - rubybutton_last[4]) > rubybutton_delay) {
rubybutton[4] = (incomingReadings.rubybutton >> 4) & 0x01;
// digitalWrite(BUTTON_DOWN, rubybutton[3]);
rubybutton_last[4] = millis();
}
// QA2 - YAW RIGHT
if((uint32_t)(millis() - rubybutton_last[5]) > rubybutton_delay) {
rubybutton[5] = (incomingReadings.rubybutton >> 5) & 0x01;
// digitalWrite(BUTTON_DOWN, rubybutton[3]);
rubybutton_last[5] = millis();
}
i2c_send[0] =
rubybutton[0] | // Menu/Ok button
rubybutton[1] << 1 | // Cancel button
rubybutton[2] << 2 | // Plus button
rubybutton[3] << 3 ; // Minus button
rubybutton[3] << 3 | // Minus button
rubybutton[4] << 4 | // QA1 button
rubybutton[5] << 5; // QA2 button
i2c_send[1] = 0;
i2c_send[2] = 0;
i2c_send[3] = 0;

3
src/main.h

@ -57,7 +57,8 @@ enum PairingStatus {
enum MessageType {
PAIRING,
DATA
DATA,
COMMAND
};
// For Ground Station Pi via I2C

Loading…
Cancel
Save