Skip to content

Commit 2f96e53

Browse files
committed
增加platform分章节
1 parent a64eacf commit 2f96e53

File tree

6 files changed

+79
-13
lines changed

6 files changed

+79
-13
lines changed

docs/.vitepress/theme/constrants/route.ts

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,20 @@ export enum Chapters {
2424
xrobot_api = "/xrobot/api/",
2525
xrobot_api_server = "/xrobot/api/server/",
2626
xrobot_api_client = "/xrobot/api/client/",
27+
// platform
28+
xrobot_platform = "/xrobot/platform",
29+
xrobot_platform_esp32 = "/xrobot/platform/esp32",
2730
// faq
2831
xrobot_faq = "/xrobot/faq/",
2932
}
3033

34+
// 判断一个link 字符串是否是章节link
35+
export function isChapter<T extends Record<string, string>>(
36+
link: string
37+
): link is T[keyof T] {
38+
return Object.values(Chapters).includes(link as Chapters);
39+
}
40+
3141
// // 给 ChapterItem 的 link 字段追加当前章节的 link 前缀
3242
// // 通过是否包含子items来判断
3343
// export function apply_prefix2(item: ChapterItem, prefix: Chapters) {
@@ -59,7 +69,7 @@ export function apply_prefix(item: ChapterItem, prefix: Chapters) {
5969
export const items_xrobot_api_server = [
6070
{
6171
text: "服务端API参考",
62-
collapsed: false,
72+
collapsed: true,
6373
link: Chapters.xrobot_api_server,
6474
items: [
6575
{ text: "用户API", link: "user" },
@@ -73,7 +83,7 @@ export const items_xrobot_api_server = [
7383
export const items_xrobot_api_client = [
7484
{
7585
text: "客户端API参考",
76-
collapsed: false,
86+
collapsed: true,
7787
link: Chapters.xrobot_api_client,
7888
items: [].map((item) => apply_prefix(item, Chapters.xrobot_api_client)),
7989
},
@@ -125,12 +135,26 @@ export const items_xrobot_guide = [
125135
},
126136
];
127137

128-
// 判断一个link 字符串是否是章节link
129-
export function isChapter<T extends Record<string, string>>(
130-
link: string
131-
): link is T[keyof T] {
132-
return Object.values(Chapters).includes(link as Chapters);
133-
}
138+
const items_xrobot_platform_esp32 = [
139+
{
140+
text: "ESP32",
141+
link: Chapters.xrobot_platform_esp32,
142+
collapsed: true,
143+
items: [
144+
{ text: "esp32-s3", link: "S3" },
145+
{ text: "esp32-c3", link: "C3" },
146+
].map((item) => apply_prefix(item, Chapters.xrobot_platform_esp32)),
147+
},
148+
];
149+
150+
const items_xrobot_platform = [
151+
{
152+
text: "设备平台",
153+
link: Chapters.xrobot_platform,
154+
collapsed: false,
155+
items: [...items_xrobot_platform_esp32],
156+
},
157+
];
134158

135159
const items_xrobot_faq = [
136160
{
@@ -148,8 +172,13 @@ const items_xrobot = [
148172
{
149173
text: "",
150174
link: Chapters.xrobot,
151-
items: [...items_xrobot_guide, ...items_xrobot_api, ...items_xrobot_faq],
152175
// collapsed: false,
176+
items: [
177+
...items_xrobot_guide,
178+
...items_xrobot_api,
179+
...items_xrobot_platform,
180+
...items_xrobot_faq,
181+
],
153182
},
154183
];
155184

@@ -184,6 +213,15 @@ export const ChapterItems: Record<Chapters, ChapterItem[]> = {
184213
gobackItem(Chapters.xrobot_guide),
185214
...items_xrobot_guide_device,
186215
],
216+
// platform
217+
[Chapters.xrobot_platform]: [
218+
gobackItem(Chapters.xrobot),
219+
...items_xrobot_platform,
220+
],
221+
[Chapters.xrobot_platform_esp32]: [
222+
gobackItem(Chapters.xrobot_platform),
223+
...items_xrobot_platform_esp32,
224+
],
187225
// faq
188226
[Chapters.xrobot_faq]: [gobackItem(Chapters.xrobot), ...items_xrobot_faq],
189227
};

docs/xrobot/device/device-intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ title: 设备使用指南
66

77
1. 七牛灵芯云提供最新版本的设备固件:
88

9-
| 芯片 | 固件 |
10-
| :------- | :------------------------------------------------------------------------------------------------------------------------------ |
11-
| ESP32-C3 | https://algorithm.qnaigc.com/xiaoling-rom/xiaoling-202507021613-ESP32C3-xiage_mini_c3-nihaoxiaozhi-without_dns.bin |
12-
| ESP32-S3 | https://algorithm.qnaigc.com/xiaoling-rom/xiaoling-202507021613-ESP32S3-bread_compact-nihaoxiaozhi_nihaoxiaoxin-without_dns.bin |
9+
| 芯片 | 固件 |
10+
| :------- | :-------------------------------------------------------------------------------------------------------------------------------- |
11+
| ESP32-C3 | <https://algorithm.qnaigc.com/xiaoling-rom/xiaoling-202507021613-ESP32C3-xiage_mini_c3-nihaoxiaozhi-without_dns.bin> |
12+
| ESP32-S3 | <https://algorithm.qnaigc.com/xiaoling-rom/xiaoling-202507021613-ESP32S3-bread_compact-nihaoxiaozhi_nihaoxiaoxin-without_dns.bin> |
1313

1414
2. 下载固件后,可参考 Flash 工具/Web 端烧录固件(无 IDF 开发环境)中的 3 种烧录方式进行烧录,推荐使用第 2 种,比较方便。
1515

docs/xrobot/platform/esp32/C3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: esp32-c3
3+
---
4+
5+
## 固件下载
6+
7+
ESP32-C3 <https://algorithm.qnaigc.com/xiaoling-rom/xiaoling-202507021613-ESP32C3-xiage_mini_c3-nihaoxiaozhi-without_dns.bin>

docs/xrobot/platform/esp32/S3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: esp32-s3
3+
---
4+
5+
## 固件下载
6+
7+
ESP32-S3 <https://algorithm.qnaigc.com/xiaoling-rom/xiaoling-202507021613-ESP32S3-bread_compact-nihaoxiaozhi_nihaoxiaoxin-without_dns.bin>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup>
2+
import { Chapters } from "../../../.vitepress/theme/constrants/route";
3+
4+
const chapter_root = Chapters.xrobot_platform_esp32;
5+
</script>
6+
7+
<ChapterContents :chapter=chapter_root />

docs/xrobot/platform/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup>
2+
import { Chapters } from "../../.vitepress/theme/constrants/route";
3+
4+
const chapter_root = Chapters.xrobot_platform;
5+
</script>
6+
7+
<ChapterContents :chapter=chapter_root />

0 commit comments

Comments
 (0)