diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec42635..e07e060 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: # could use a container with sq tools already installed image: infinitecoding/platformio-for-ci:latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -63,11 +63,11 @@ jobs: echo $VERSION > version.txt echo Building OBS Version: $VERSION sed -i 's|-DBUILD_NUMBER=\\"-dev\\"|-DBUILD_NUMBER=\\"'${SEPARATOR}${PATCH}'\\"|' platformio.ini - echo "SONAR_SCANNER_VERSION=7.1.0.4889" >> $GITHUB_ENV + echo "SONAR_SCANNER_VERSION=8.0.1.6346" >> $GITHUB_ENV - name: Cache SonarCloud packages id: cache-sonar - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: | ~/.sonar/cache @@ -300,7 +300,7 @@ jobs: - name: Generate changelog id: changelog if: ${{ env.OBS_PREPARE_RELEASE == 'true' }} - uses: metcalfc/changelog-generator@v4.3.1 + uses: metcalfc/changelog-generator@v4 with: myToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5984567..460a229 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,15 +25,12 @@ jobs: name: Analyze runs-on: ubuntu-latest container: - # could use a container with sq tools already installed image: infinitecoding/platformio-for-ci:latest strategy: fail-fast: false matrix: - language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: + language: [ 'cpp', 'actions' ] # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: @@ -42,7 +39,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -55,4 +52,4 @@ jobs: platformio ci --build-dir="./bin" --keep-build-dir --project-conf=platformio.ini ./src/ - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 diff --git a/src/OpenBikeSensorFirmware.cpp b/src/OpenBikeSensorFirmware.cpp index 052ff2f..b6440a5 100644 --- a/src/OpenBikeSensorFirmware.cpp +++ b/src/OpenBikeSensorFirmware.cpp @@ -229,70 +229,6 @@ static void buttonBluetooth(const DataSet *dataSet, uint16_t measureIndex) { static uint8_t shutdownState = 0; -#ifdef OBSPRO -// Power-management keep alive timer -// This function is called every 100 ms -static unsigned long timeOfLastPowerKeepAlive = 0; -static uint8_t buttonPressedCounter = 0; -static void powerKeepAliveTimerISR() -{ - // Send "keep alive" trigger to power management module - // This is done by toggling the pin every 300 ms or more - if(shutdownState == 0) - { - if(!digitalRead(IP5306_BUTTON) && millis() - timeOfLastPowerKeepAlive > POWER_KEEP_ALIVE_INTERVAL_MS) - { - timeOfLastPowerKeepAlive = millis(); - digitalWrite(IP5306_BUTTON, HIGH); - } - else if(digitalRead(IP5306_BUTTON) && millis() - timeOfLastPowerKeepAlive > 300) - { - timeOfLastPowerKeepAlive = millis(); - digitalWrite(IP5306_BUTTON, LOW); - } - } - - // Soft power-off OBSPro when button is pressed for more than 2 seconds - if(button.read()) - { - if(buttonPressedCounter < 255) - buttonPressedCounter++; - } - else - buttonPressedCounter = 0; - - if(shutdownState == 0 && buttonPressedCounter >= 50) { - shutdownState = 1; - } - switch(shutdownState) - { - case 1: - digitalWrite(IP5306_BUTTON, LOW); - break; - case 4: - digitalWrite(IP5306_BUTTON, HIGH); - break; - case 7: - digitalWrite(IP5306_BUTTON, LOW); - break; - case 10: - digitalWrite(IP5306_BUTTON, HIGH); - break; - case 13: - digitalWrite(IP5306_BUTTON, LOW); - noInterrupts(); - while(1) - NOP(); - break; - default: - break; - } - if(shutdownState != 0 && shutdownState < 13) - shutdownState++; -} - -#endif - void setup() { Serial.begin(115200); log_i("openbikesensor.org - OBS/%s", OBSVersion); @@ -310,14 +246,6 @@ void setup() { digitalWrite(GPS_POWER_PIN,HIGH); #endif -#ifdef OBSPRO - // Setup power management timer to trigger every 100ms (clock is 80 MHz) - timer0_powermanagement_cfg = timerBegin(0, 1000, true); - timerAttachInterrupt(timer0_powermanagement_cfg, &powerKeepAliveTimerISR, true); - timerAlarmWrite(timer0_powermanagement_cfg, 8000, true); - timerAlarmEnable(timer0_powermanagement_cfg); -#endif - //############################################################## // Setup display //############################################################## diff --git a/src/displays.h b/src/displays.h index 44af388..e469c10 100644 --- a/src/displays.h +++ b/src/displays.h @@ -61,22 +61,12 @@ class DisplayDevice { private: void handleHighlight(); void displaySimple(uint16_t value); -#ifdef OBSPRO - U8G2* m_display = new U8G2_ST7567_JLX12864_F_4W_HW_SPI(U8G2_R0, LCD_CS_PIN, LCD_DC_PIN, LCD_RESET_PIN); // SPI based JHD12864-G156BT for OBSPro -#endif -#ifdef OBSCLASSIC U8G2* m_display = new U8G2_SSD1306_128X64_NONAME_F_HW_I2C(U8G2_R0, U8X8_PIN_NONE); // original OBSClassic display -#endif String gridText[ 4 ][ 6 ]; uint8_t mLastProgress = 255; uint8_t mCurrentLine = 0; bool mInverted = false; -#ifdef OBSPRO - bool mFlipped = false; -#endif -#ifdef OBSCLASSIC bool mFlipped = true; -#endif uint32_t mHighlightTill = 0; bool mHighlighted = false; diff --git a/src/gps.cpp b/src/gps.cpp index a364059..a99441b 100644 --- a/src/gps.cpp +++ b/src/gps.cpp @@ -72,6 +72,7 @@ void Gps::begin() { configureGpsModule(); } pollStatistics(); +#ifndef UBX_M10 if((!is_neo6()) || (!SD.exists(AID_INI_DATA_FILE_NAME))) { // we're on a non-6 neo and avoid AID_INI because is deprecated // or we're on a neo6 but last boot we didn't get far enough to receive fresh @@ -83,6 +84,7 @@ void Gps::begin() { coldStartGps(); } pollStatistics(); +#endif if (is_neo6()) { enableAlpIfDataIsAvailable(); diff --git a/src/utils/button.cpp b/src/utils/button.cpp index 224e1db..150e8de 100644 --- a/src/utils/button.cpp +++ b/src/utils/button.cpp @@ -65,11 +65,7 @@ bool Button::gotPressed() { int Button::read() const { // not debounced -#ifdef OBSPRO - return !digitalRead(mPin); -#else return digitalRead(mPin); -#endif } int Button::getState() const { diff --git a/src/variant.h b/src/variant.h index 7ee270c..1e5379f 100644 --- a/src/variant.h +++ b/src/variant.h @@ -27,11 +27,7 @@ // Use custom_config.ini to set the needed variant! // If set, the firmware is build for the OBSPro hardware variant -// The main differences are: -// - The button is inverted -// - The button is also responsible for soft-power-off -// - The display is a JHD12864-G156BT which is SPI based -// - The ultrasonic sensors are PGA460 based +// The main difference is the ultrasonic sensors being PGA460 based //#define OBSPRO // If set, the firmware is build for the OBSClassic @@ -39,9 +35,6 @@ // Settings specific to OBSPro #ifdef OBSPRO -#define LCD_CS_PIN 12 -#define LCD_DC_PIN 27 -#define LCD_RESET_PIN 4 #define SENSOR1_SCK_PIN 25 #define SENSOR1_MOSI_PIN 33 @@ -49,7 +42,7 @@ #define SENSOR2_SCK_PIN 14 #define SENSOR2_MOSI_PIN 15 -#define SENSOR2_MISO_PIN 21 +#define SENSOR2_MISO_PIN 26 #define UBX_M10 #define POWER_KEEP_ALIVE_INTERVAL_MS 5000UL diff --git a/src/writer.cpp b/src/writer.cpp index dc51cc1..42dde2e 100644 --- a/src/writer.cpp +++ b/src/writer.cpp @@ -127,7 +127,7 @@ bool CSVFileWriter::writeHeader(String trackId) { header += "OBSFirmwareVersion=" + String(OBSVersion) + "&"; #ifdef OBSPRO header += "HardwareType=OBSPro&"; - header += "HardwareRev=v2.1&"; // TODO: Use hardware revision detection + header += "HardwareRev=v2.2&"; // TODO: Use hardware revision detection #endif #ifdef OBSCLASSIC header += "HardwareType=OBSClassic&";