Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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
72 changes: 0 additions & 72 deletions src/OpenBikeSensorFirmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
//##############################################################
Expand Down
10 changes: 0 additions & 10 deletions src/displays.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -83,6 +84,7 @@ void Gps::begin() {
coldStartGps();
}
pollStatistics();
#endif

if (is_neo6()) {
enableAlpIfDataIsAvailable();
Expand Down
4 changes: 0 additions & 4 deletions src/utils/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 2 additions & 9 deletions src/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,22 @@

// 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
//#define OBSCLASSIC

// 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
#define SENSOR1_MISO_PIN 32

#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
Expand Down
2 changes: 1 addition & 1 deletion src/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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&";
Expand Down
Loading