Update RC_Excavator_TX.ino, configuration.h, configuration_input.h, and 2 more files

This commit is contained in:
mxcory
2024-12-11 14:10:40 -05:00
parent fa5941fd91
commit a61cd98d87
5 changed files with 68 additions and 23 deletions
+2 -3
View File
@@ -14,7 +14,6 @@ By: mxcory
#include "structs.h"
#include "configuration.h"
#include "configuration_input.h"
//Initiate transceiver object
@@ -31,8 +30,6 @@ PayloadStruct payload;
void setup() {
Serial.begin(115200);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
if (!radio.begin()) {
Serial.println("Radio not respodind...");
@@ -62,6 +59,8 @@ void loop() {
bool report = radio.write(&payload, sizeof(payload)); //Transmit message
unsigned long MSG_TIMER_END = micros(); //End message timer
#include "configuration_input.h"
#ifdef DEBUG_ME
if (report) {
+9 -2
View File
@@ -4,7 +4,7 @@
//___Pin Connections___
//Radio Pins
#define CE_PIN 9//2
#define CE_PIN 28//2
#define CSN_PIN 53//4
//___Software Config___
@@ -16,4 +16,11 @@ char TID = 'BB'; //RX device ID
//___Advanced___
//Radio Power Level
#define RADIO_PA_LEVEL 1
#define RADIO_PA_LEVEL 1
//Number of channels
#define NUM_CHANNELS 10
//Byte array for inputs
int TX_CHANNELS[ NUM_CHANNELS+1 ][ 10 ] = {0};
+42 -7
View File
@@ -1,11 +1,43 @@
//Number of channels
#define NUM_CHANNELS 10
/*
Input Settings
*/
//Byte array for inputs
byte TX_CHANNELS[ NUM_CHANNELS+1 ][ 10 ] = {0};
//Channel Input
TX_CHANNELS[0][_PIN] = -1;
TX_CHANNELS[0][_TYPE] = IN_BIN;
TX_CHANNELS[1][_PIN] = A13;
TX_CHANNELS[1][_TYPE] = IN_CTR_POT;
TX_CHANNELS[1][_MIN] = 525;
TX_CHANNELS[2][_PIN] = A12;
TX_CHANNELS[2][_TYPE] = IN_CTR_POT;
TX_CHANNELS[2][_MIN] = 499;
TX_CHANNELS[3][_PIN] = -1;
TX_CHANNELS[3][_TYPE] = IN_BIN;
TX_CHANNELS[4][_PIN] = -1;
TX_CHANNELS[4][_TYPE] = IN_BIN;
TX_CHANNELS[5][_PIN] = -1;
TX_CHANNELS[5][_TYPE] = IN_BIN;
TX_CHANNELS[6][_PIN] = -1;
TX_CHANNELS[6][_TYPE] = IN_BIN;
TX_CHANNELS[7][_PIN] = -1;
TX_CHANNELS[7][_TYPE] = IN_BIN;
TX_CHANNELS[8][_PIN] = -1;
TX_CHANNELS[8][_TYPE] = IN_BIN;
TX_CHANNELS[9][_PIN] = -1;
TX_CHANNELS[9][_TYPE] = IN_BIN;
TX_CHANNELS[10][_PIN] = -1;
TX_CHANNELS[10][_TYPE] = IN_BIN;
@@ -19,5 +51,8 @@ byte TX_CHANNELS[ NUM_CHANNELS+1 ][ 10 ] = {0};
//Channel 2
//Left Track
#define CHAN_2_PIN 0
#define CHAn_3_PIN 0
#define CHAN_2_PIN A13
#define CHAn_3_PIN 0
+4 -1
View File
@@ -4,6 +4,7 @@
#define _MAX 2
#define _TYPE 3
#define _VAL 4
#define _PIN 5
//Channel type defines
@@ -11,4 +12,6 @@
#define IN_BIN 1 //Binary type
#define IN_MULTI 3 //Multiple position switch
#define IN_CTR_POT 4 //Potentiometer with center position
#define IN_CTR_POT_2 5 //Potentiometer with center that needs second channel
bool enableFlag = false; //Flag for channel 0
+11 -10
View File
@@ -6,27 +6,28 @@ bool setMessage() {
int _length = NUM_CHANNELS + 1; //Number of channels plus reserved positions
char _SEND_MESSAGE [ _length ];
_SEND_MESSAGE[0] = -128; //Place Device ID into first position
//_SEND_MESSAGE[1] = 200; //Place Target ID into second position
//_SEND_MESSAGE[2] = 5; //Place enable flag in third position
_SEND_MESSAGE[0] = 0; //Place Device ID into first position
//TX_CHANNELS[1][_VAL] = map(analogRead(A0), 0, 255, -128, 128);
TX_CHANNELS[2][_VAL] = map(analogRead(A1), 500, 1024, 0, 255);
//Serial.println(map(analogRead(A1), 0, 1024, -128, 128));
Serial.println(analogRead(A1));
TX_CHANNELS[1][_VAL] = map(analogRead(TX_CHANNELS[1][_PIN]), TX_CHANNELS[1][_MIN], 1024, 0, 255);
TX_CHANNELS[2][_VAL] = map(analogRead(TX_CHANNELS[2][_PIN]), TX_CHANNELS[2][_MIN], 1024, 0, 255);
Serial.print(analogRead(TX_CHANNELS[1][_PIN]));
Serial.print(" < LEFT : RIGHT > ");
Serial.print(analogRead(TX_CHANNELS[2][_PIN]));
Serial.print(" | Send Value : ");
Serial.print(TX_CHANNELS[1][_VAL]);
for ( int i=1; i<_length; i++) { //Place channel values srarting at pos 2
_SEND_MESSAGE[i] = TX_CHANNELS[i][_VAL] + _mod;
}
//_mod++;
memcpy(payload.message, _SEND_MESSAGE, 24); //Copy message into payload
Serial.print(sizeof(payload.message));
//Serial.print(sizeof(payload.message));
//Serial.print(" ");
for (int i=0; i<sizeof(_SEND_MESSAGE); i++) {
//Serial.print(_SEND_MESSAGE[i]);