// 主机侧验证用:把 QR 矩阵打到 stdout,供 tools/qr_verify.py 与 python qrcode 比对。 // 只在开发机上编译,不进固件。 #include #include #include "../src/ui/QrCode.h" int main(int argc, char** argv) { if (argc < 2) { fprintf(stderr, "usage: qr_dump \n"); return 2; } static uint8_t buf[160 * 160]; int side = 0, mask = 0; if (!ui::qrEncode(argv[1], buf, 160, side, mask)) { printf("FAIL\n"); return 1; } printf("%d %d\n", side, mask); for (int y = 0; y < side; y++) { for (int x = 0; x < side; x++) putchar(buf[y * side + x] ? '1' : '0'); putchar('\n'); } return 0; }