diff --git a/.vscode/settings.json b/.vscode/settings.json index da44c62..0abc57a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,83 @@ }, "C_Cpp.default.configurationProvider": "vscode-wpilib", "files.associations": { - "*.inc": "cpp" + "*.inc": "cpp", + "array": "cpp", + "any": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "cfenv": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "expected": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "regex": "cpp", + "source_location": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "ranges": "cpp", + "semaphore": "cpp", + "span": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "variant": "cpp" } } diff --git a/src/main/cpp/subsystems/LED.cpp b/src/main/cpp/subsystems/LED.cpp index 347ff25..1447351 100644 --- a/src/main/cpp/subsystems/LED.cpp +++ b/src/main/cpp/subsystems/LED.cpp @@ -42,9 +42,9 @@ void LED::Init() { m_pserial->SetReadBufferSize(0); m_pserial->SetWriteBufferMode(frc::SerialPort::kFlushOnAccess); - rx_index = 0; + m_rxIndex = 0; for(int i = 0; i < BUFF_SIZE; i++) { - rx_buff[i] = 0; + m_rxBuff[i] = 0; } //SetTargetType(LED_STAGE_enum::WHITE); } @@ -66,21 +66,21 @@ void LED::Update() { // printf("LED: in Update, attempting to receive\n"); while (m_pserial->GetBytesReceived() > 0) { - m_pserial->Read(&rx_buff[rx_index], 1); + m_pserial->Read(&m_rxBuff[m_rxIndex], 1); - if((rx_buff[rx_index] == '\r') || (rx_buff[rx_index] == '\n')) { + if((m_rxBuff[m_rxIndex] == '\r') || (m_rxBuff[m_rxIndex] == '\n')) { // process report - if(rx_index == 0) { + if(m_rxIndex == 0) { // no report continue; } // terminate the report string - rx_buff[rx_index] = 0; + m_rxBuff[m_rxIndex] = 0; // print the report: - printf("RX: %s\n", rx_buff); + printf("RX: %s\n", m_rxBuff); m_pserial->Flush(); ProcessReport(); @@ -88,11 +88,11 @@ void LED::Update() { // printf("LED report: rx_buff\n"); // reset for next report - rx_index = 0; + m_rxIndex = 0; } else { // have not received end of report yet - if(rx_index < BUFF_SIZE - 1) { - rx_index++; + if(m_rxIndex < BUFF_SIZE - 1) { + m_rxIndex++; } } } diff --git a/src/main/include/subsystems/LED.h b/src/main/include/subsystems/LED.h index 8c2334b..7910b63 100644 --- a/src/main/include/subsystems/LED.h +++ b/src/main/include/subsystems/LED.h @@ -5,7 +5,7 @@ #ifndef H_LED #define H_LED -#include "Constants.h" //yay i can use CONE and CUBE +#include "Constants.h" #include #define BUFF_SIZE 256 @@ -51,9 +51,9 @@ class LED : public frc2::SubsystemBase { std::array, ArduinoConstants::NUMBER_OF_LED_STATES> m_LEDArray; frc::SerialPort* m_pserial; - char rx_buff[BUFF_SIZE]; - int rx_index = 0; - float valAngle = 0; + char m_rxBuff[BUFF_SIZE]; + int m_rxIndex = 0; + float m_valAngle = 0; //LED_STAGE_enum target_type = LED_STAGE_enum::WHITE; ArduinoConstants::RIO_MESSAGES LED_prevCommand = ArduinoConstants::RIO_MESSAGES::MSG_IDLE; ArduinoConstants::RIO_MESSAGES LED_currentCommand = ArduinoConstants::RIO_MESSAGES::MSG_IDLE;