Skip to content
Closed

Dev #26

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
26 changes: 13 additions & 13 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
branches:
- main
paths:
- 'Firmware/**'
- 'Software/**'
- 'firmware/**'
- 'tools/**'
- '.github/workflows/code-quality.yml'
push:
branches:
- main
paths:
- 'Firmware/**'
- 'Software/**'
- 'firmware/**'
- 'tools/**'
schedule:
# 每天凌晨 2 点运行一次完整扫描
- cron: '0 2 * * *'
Expand Down Expand Up @@ -71,22 +71,22 @@ jobs:
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: Software/binary-keyboard-studio-ui/pnpm-lock.yaml
cache-dependency-path: tools/studio/pnpm-lock.yaml

- name: Install dependencies
working-directory: Software/binary-keyboard-studio-ui
working-directory: tools/studio
run: pnpm install

- name: Run ESLint
working-directory: Software/binary-keyboard-studio-ui
working-directory: tools/studio
run: pnpm run lint || echo "ESLint check completed with warnings"

- name: Run TypeScript type check
working-directory: Software/binary-keyboard-studio-ui
working-directory: tools/studio
run: pnpm run type-check

- name: Build check
working-directory: Software/binary-keyboard-studio-ui
working-directory: tools/studio
run: pnpm run build-only

# C/C++ 代码质量检查
Expand All @@ -103,15 +103,15 @@ jobs:
sudo apt-get update
sudo apt-get install -y cppcheck

- name: Run cppcheck on Firmware
- name: Run cppcheck on firmware
continue-on-error: true
run: |
cppcheck --enable=all --suppress=missingIncludeSystem \
--xml --xml-version=2 \
Firmware/CH592F/ 2> cppcheck-result.xml || true
firmware/CH592F/ 2> cppcheck-result.xml || true
cppcheck --enable=all --suppress=missingIncludeSystem \
--xml --xml-version=2 \
Firmware/CH552G/ 2> cppcheck-result2.xml || true
firmware/CH552G/ 2> cppcheck-result2.xml || true

- name: Upload cppcheck results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
- name: Check code duplication (JavaScript/TypeScript)
continue-on-error: true
run: |
jscpd Software/ --min-lines 5 --min-tokens 50 --format markdown > duplication-report.md || true
jscpd tools/studio/ --min-lines 5 --min-tokens 50 --format markdown > duplication-report.md || true

- name: Upload complexity report
uses: actions/upload-artifact@v4
Expand Down
5 changes: 3 additions & 2 deletions firmware/CH592F/MeowBLE/profile/src/devinfoservice.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/********************************** (C) COPYRIGHT *******************************
/********************************** (C) COPYRIGHT *******************************
* File Name : devinfoservice.c
* Author : WCH
* Version : V1.0
Expand All @@ -15,6 +15,7 @@
*/
#include "ble_config.h"
#include "devinfoservice.h"
#include "kbd_types.h"

/*********************************************************************
* MACROS
Expand Down Expand Up @@ -132,7 +133,7 @@ static uint8_t devInfoPnpId[DEVINFO_PNP_ID_LEN] = {
1, // Vendor ID source (1=Bluetooth SIG)
LO_UINT16(0x07D7), HI_UINT16(0x07D7), // Vendor ID (WCH)
LO_UINT16(0x0000), HI_UINT16(0x0000), // Product ID (vendor-specific)
LO_UINT16(0x0110), HI_UINT16(0x0110) // Product version (JJ.M.N)
LO_UINT16(KBD_VERSION_BCD16), HI_UINT16(KBD_VERSION_BCD16) // Product version (与 kbd_types.h 同步)
};

/*********************************************************************
Expand Down
4 changes: 3 additions & 1 deletion firmware/CH592F/MeowKeyboard/include/kbd_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ extern "C" {
*/
#define KBD_VENDOR_ID 0x413D /**< USB Vendor ID */
#define KBD_PRODUCT_ID 0x2107 /**< USB Product ID */
#define KBD_VERSION_MAJOR 2 /**< 固件主版本 */
#define KBD_VERSION_MAJOR 3 /**< 固件主版本 */
#define KBD_VERSION_MINOR 0 /**< 固件次版本 */
#define KBD_VERSION_PATCH 0 /**< 固件补丁版本 */
/** 主.次 版本 BCD 16 位,供 USB bcdDevice、BLE PnP 等使用,改主/次版本后自动同步 */
#define KBD_VERSION_BCD16 ((KBD_VERSION_MAJOR << 8) | KBD_VERSION_MINOR)

/** @} */ /* end of KBD_Constants */

Expand Down
1 change: 1 addition & 0 deletions firmware/CH592F/MeowKeyboard/src/kbd_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "kbd_log.h"
#include "kbd_storage.h"
#include "kbd_mode.h"
#include <string.h>

/*============================================================================*/
Expand Down
3 changes: 2 additions & 1 deletion firmware/CH592F/MeowUSB/src/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*******************************************************************************/

#include "usb_descriptors.h"
#include "kbd_types.h"

/* USB 设备描述符 */
const uint8_t USB_DeviceDescriptor[] = {
Expand All @@ -19,7 +20,7 @@ const uint8_t USB_DeviceDescriptor[] = {
DevEP0SIZE, // bMaxPacketSize0
(USB_VID & 0xFF), (USB_VID >> 8), // idVendor
(USB_PID & 0xFF), (USB_PID >> 8), // idProduct
0x00, 0x01, // bcdDevice (1.00)
(KBD_VERSION_BCD16 & 0xFF), (KBD_VERSION_BCD16 >> 8), // bcdDevice (与 kbd_types.h 同步)
0x01, // iManufacturer
0x02, // iProduct
0x00, // iSerialNumber
Expand Down
Loading