Skip to content

Commit

Permalink
0401D board updates (#96)
Browse files Browse the repository at this point in the history
* Updated OLED [128x64] layout for 0401D board.
* Add clock/uptime display on 128x64 OLED display on 0401D boards.
* Use per board default configurations (JSON).
  Move configurations under src/boards/ directory.
* Update SYS:SPI command documentation.
* Update CodeQL workflow actions to new versions.
  • Loading branch information
tjko authored Aug 2, 2024
1 parent 568f71b commit 40b9b95
Show file tree
Hide file tree
Showing 13 changed files with 598 additions and 31 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,36 @@ jobs:
steps:
- name: Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1

- name: Cache Pico-SDK
id: cache-pico-sdk
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: pico-sdk
key: ${{runner.os}}-pico-sdk-${{env.PICO_SDK_REF}}

- if: ${{steps.cache-pico-sdk.outputs.cache-hit != 'true' }}
name: Checkout Pico-SDK
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: ${{env.PICO_SDK_REF}}
path: pico-sdk
submodules: true

- name: Add PICO_SDK_PATH to Environment
run: |
echo "PICO_SDK_PATH=${{github.workspace}}/pico-sdk" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main
submodules: recursive

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand Down Expand Up @@ -105,9 +105,9 @@ jobs:
run: cmake -S main -B main/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=pico_w -DFANPICO_BOARD=0804D

- name: Build
run: cmake --build main/build --config ${{env.BUILD_TYPE}}
run: cmake --build main/build --config ${{env.BUILD_TYPE}}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ add_executable(fanpico
src/util_rp2040.c
src/log.c
src/crc32.c
src/default_config.s
src/default_config.S
src/credits.s
src/logos/default.s
src/themes/lcd-background.s
Expand Down
9 changes: 6 additions & 3 deletions commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2448,9 +2448,12 @@ SYS:SERIAL?
```

#### SYStem:SPI
Enable or disable SPI bus (on connector J18). When SPI bus is enabled I22 (OLED display) and Serial TTL connectors cannot be used
as these share pins with the SPI bus.
Reason to enable SPI bus would be to connect LCD panel on the J18 connector.
Enable or disable SPI bus (on boards that have "SPI" connector).
Reason to enable SPI bus would be to connect LCD panel on the SPI connector.

NOTE! On 0804D boards, when SPI bus is enabled I2C (OLED display) and Serial (TTL) connectors cannot be used
as these share pins with the SPI bus.


Example (enable SPI bus):
```
Expand Down
5 changes: 5 additions & 0 deletions src/boards/0401D.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#define RX_PIN 1

/* SPI */
#define SPI_SHARED 0 /* 0 = dedicated pins, 1 = shared with serial/i2c */
#define SCK_PIN 10
#define MOSI_PIN 11
#define MISO_PIN -1
Expand All @@ -94,3 +95,7 @@
#define TTL_SERIAL 1
#define TTL_SERIAL_UART uart0
#define TTL_SERIAL_SPEED 115200

/* Use non-default OLED layouts for this board */
#define R_LAYOUT_128x64 "LMB Input,M1,-,LSensors,S1,S2,S3,V1"
#define R_LAYOUT_128x128 "LMB Input,M1,-,LSensors,S1,S2,S3,V1,V2,V3"
215 changes: 215 additions & 0 deletions src/boards/0401D.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{
"id": "fanpico-config-v1",
"debug": 0,
"local_echo": false,
"led_mode": 0,
"spi_active": 0,
"serial_active": 1,
"sensors": [
{
"id": 0,
"name": "sensor1",
"sensor_type": 1,
"series_resistance": 10000,
"thermistor_nominal": 10000,
"temperature_nominal": 25.0,
"beta_coefficient": 3950,
"temp_offset": 0.0,
"temp_coefficient": 1.0,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 1,
"name": "sensor2",
"sensor_type": 1,
"series_resistance": 10000,
"thermistor_nominal": 10000,
"temperature_nominal": 25.0,
"beta_coefficient": 3950,
"temp_offset": 0.0,
"temp_coefficient": 1.0,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 2,
"name": "pico_temp",
"sensor_type": 0,
"temp_offset": 0.0,
"temp_coefficient": 1.0,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
}
],
"vsensors": [
{
"id": 0,
"name": "vsensor1",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 1,
"name": "vsensor2",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 2,
"name": "vsensor3",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 3,
"name": "vsensor4",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 4,
"name": "vsensor5",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 5,
"name": "vsensor6",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 6,
"name": "vsensor7",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
},
{
"id": 7,
"name": "vsensor8",
"mode": "manual",
"default_temp": 0,
"timeout": 30,
"temp_map": [
[ 20, 0 ],
[ 50, 100 ]
]
}
],
"fans": [
{
"id": 0,
"name": "fan1",
"min_pwm": 0,
"max_pwm": 100,
"pwm_coefficient": 1.0,
"source_type": "mbfan",
"source_id": 0,
"pwm_map": [
[ 0, 0 ],
[ 100, 100 ]
],
"rpm_factor": 2
},
{
"id": 1,
"name": "fan2",
"min_pwm": 0,
"max_pwm": 100,
"pwm_coefficient": 1.0,
"source_type": "mbfan",
"source_id": 0,
"pwm_map": [
[ 0, 0 ],
[ 100, 100 ]
],
"rpm_factor": 2
},
{
"id": 2,
"name": "fan3",
"min_pwm": 0,
"max_pwm": 100,
"pwm_coefficient": 1.0,
"source_type": "mbfan",
"source_id": 0,
"pwm_map": [
[ 0, 0 ],
[ 100, 100 ]
],
"rpm_factor": 2
},
{
"id": 3,
"name": "fan4",
"min_pwm": 0,
"max_pwm": 100,
"pwm_coefficient": 1.0,
"source_type": "mbfan",
"source_id": 0,
"pwm_map": [
[ 0, 0 ],
[ 100, 100 ]
],
"rpm_factor": 2
}
],
"mbfans": [
{
"id": 0,
"name": "mbfan1",
"min_rpm": 0,
"max_rpm": 10000,
"rpm_coefficient": 1.0,
"rpm_factor": 2,
"source_type": "fan",
"source_id": 0,
"rpm_map": [
[ 0, 0 ],
[ 10000, 10000 ]
]
}
]
}
9 changes: 5 additions & 4 deletions src/boards/0804.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@
#define RX_PIN -1

/* SPI */
#define SCK_PIN -1
#define MOSI_PIN -1
#define MISO_PIN -1
#define CS_PIN -1
#define SPI_SHARED 1 /* 0 = dedicated pins, 1 = shared with serial/i2c */
#define SCK_PIN -1
#define MOSI_PIN -1
#define MISO_PIN -1
#define CS_PIN -1

#define DC_PIN -1
#define LCD_RESET_PIN -1
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/boards/0804D.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#define RX_PIN 1

/* SPI */
#define SPI_SHARED 1 /* 0 = dedicated pins, 1 = shared with serial/i2c */
#define SCK_PIN 2
#define MOSI_PIN 3
#define MISO_PIN -1
Expand Down
Loading

0 comments on commit 40b9b95

Please sign in to comment.