├── .gitignore ├── .vscode ├── c_cpp_properties.json ├── extensions.json └── settings.json ├── LICENSE ├── README.md ├── README_cn.md ├── doc ├── ESP32引脚定义.webp └── 菜单最优跳转算法.xlsx ├── files └── 朱雀.pptx ├── hardware ├── V1.0 │ ├── Gerber_PCB_OpenT12_精简.zip │ ├── PCB_OpenT12_精简_2021-10-22.pcbdoc │ ├── PCB_PCB_OpenT12_精简_2021-10-22.json │ ├── SCH_朱雀T12焊台_2021-10-22.json │ └── 精简版V5_2021-10-22.schdoc ├── V2.0 │ ├── History │ │ ├── 精简焊台.~(1).PcbDoc.Zip │ │ └── 精简焊台.~(2).PcbDoc.Zip │ ├── PCB_OpenT12_精简_2021-10-27.PcbLib │ ├── PCB_Project.PrjPcb │ ├── PCB_Project.PrjPcbStructure │ ├── PCB_Project.SCHLIB │ ├── __Previews │ │ └── 精简版V5_2021-10-27.schdocPreview │ ├── 精简焊台.PcbDoc │ └── 精简版V5_2021-10-27.schdoc └── V2.1 │ ├── ASCII.PcbDoc │ ├── LCEDA_PCB.json │ ├── PCB_OpenT12_精简_2021-10-27.PcbLib │ ├── PCB_Project.PrjPcb │ ├── PCB_Project.PrjPcbStructure │ ├── PCB_Project.SCHLIB │ ├── Snipaste_2021-11-28_19-11-10.jpg │ ├── __Previews │ └── 精简版V5_2021-10-27.schdocPreview │ ├── 精简焊台.PcbDoc │ └── 精简版V5_2021-10-27.schdoc ├── img ├── Cursor.bmp ├── J3F}W4XX_3]NT2K_JGCY}(J.jpg ├── Logo.bmp ├── Logo.png ├── Logo.sai2 ├── MainScreen.png ├── OLED_ScreenshotInit │ ├── PID.png │ ├── 修改PID.png │ ├── 加热.png │ ├── 密码输入.png │ ├── 校准页面.png │ ├── 欠压提醒.png │ ├── 温度场景.png │ ├── 温度系数.png │ ├── 爆发.png │ ├── 翻转屏幕.png │ ├── 配置列表.png │ ├── 重命名.png │ └── 错误.png ├── PixeSymbol2字符映射表.png ├── PixeSymbol3.ttf ├── PixeSymbol3字符映射表.png ├── PixeSymbol字符映射表.png ├── README.txt ├── c1.png ├── c2.png ├── c3.png ├── c4.png ├── c5.png ├── c6.png ├── c7.png ├── readme │ ├── ArduinoIDE_1.jpg │ ├── ArduinoIDE_2.jpg │ ├── ArduinoIDE_3.jpg │ ├── ArduinoIDE_4.jpg │ ├── ArduinoIDE_5.jpg │ ├── ArduinoIDE_6.jpg │ ├── Esp32_IDE_Set.jpg │ ├── PCB3.0.jpg │ └── Pcb_V1.0.png ├── 休眠.png ├── 停机32x32.png ├── 升温32x32.png ├── 发热丝-弃.png ├── 指示针.png ├── 提升32x32.png ├── 文本 │ ├── .vscode │ │ ├── c_cpp_properties.json │ │ ├── launch.json │ │ ├── settings.json │ │ └── tasks.json │ ├── Back.png │ ├── StartTFBitMap.bat │ ├── bitmaps.h │ ├── start.cpp.disable │ ├── start.exe │ ├── t0.png │ ├── t1.png │ ├── t19.png │ ├── t1_1.png │ ├── t1_2.png │ ├── t1_3.png │ ├── t1_4.png │ ├── t2.png │ ├── t2_0.png │ ├── t2_1.png │ ├── t2_2.png │ ├── t3.png │ ├── t4.png │ ├── t4f.png │ ├── t5.png │ ├── t5_0.png │ ├── t5_1.png │ ├── t5_3.png │ ├── t6.png │ ├── t7.png │ ├── tAbout.png │ ├── tPassword.png │ ├── t_4.png │ ├── t_CN_CN.png │ ├── t_CN_EN.png │ ├── t_CN_JP.png │ ├── t_NO.png │ ├── t_OK.png │ ├── t_PID.png │ ├── t_off.png │ ├── t_on.png │ └── t_save.png ├── 无.png ├── 朱雀_复古.png ├── 标签.png ├── 正常32x32.png ├── 温度计.png ├── 维持32x32.png ├── 芯片16x16.png ├── 菜单树.sai2 ├── 蓝牙.png ├── 设置 │ ├── BLE.png │ ├── IMG_Animation.png │ ├── IMG_Animation_DISABLE.png │ ├── IMG_Files.png │ ├── IMG_Flip.png │ ├── IMG_ListMode.png │ ├── IMG_Load.png │ ├── IMG_Pen.bmp │ ├── IMG_Pen2.png │ ├── IMG_ReedSwitch.png │ ├── IMG_Size.png │ ├── IMG_Sun.png │ ├── IMG_Tip.png │ ├── IMG_VibrationSwitch.png │ ├── Lang_CN.png │ ├── Lang_EN.png │ ├── Lang_JP.png │ ├── Load.png │ ├── Set0.png │ ├── Set1.png │ ├── Set10.png │ ├── Set11.png │ ├── Set12.png │ ├── Set13.png │ ├── Set14.png │ ├── Set15.png │ ├── Set16.png │ ├── Set17.png │ ├── Set18.png │ ├── Set19.png │ ├── Set2.png │ ├── Set3.png │ ├── Set4.png │ ├── Set4F.png │ ├── Set4FF.png │ ├── Set5.png │ ├── Set5_1.png │ ├── Set6.png │ ├── Set7.png │ ├── Set8.png │ ├── Set9.png │ ├── Set_LANG.png │ ├── Trigger.png │ ├── c_NO.png │ └── save.png ├── 设置16x16.png ├── 过场.png ├── 过场1.png ├── 过场2.png ├── 错误32x32.png └── 闪电16x16.png ├── include ├── BLE.h ├── Beep.h ├── Bezier.h ├── Bitmap.h ├── Calibration.h ├── Event.h ├── ExternDraw.h ├── FilesSystem.h ├── MathFun.h ├── Menu.h ├── MyShell.h ├── OpenT12.h ├── README ├── Rotary.h ├── TipControl.h ├── TipManager.h ├── Type.h └── serial_putc.h ├── lib ├── OneButton │ ├── .github │ │ └── workflows │ │ │ └── arduino-checks.yml │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── BlinkMachine │ │ │ └── BlinkMachine.ino │ │ ├── InterruptOneButton │ │ │ └── InterruptOneButton.ino │ │ ├── SimpleOneButton │ │ │ └── SimpleOneButton.ino │ │ ├── SpecialInput │ │ │ └── SpecialInput.ino │ │ └── TwoButtons │ │ │ └── TwoButtons.ino │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── src │ │ ├── OneButton.cpp │ │ └── OneButton.h ├── PID │ ├── PID_v1.cpp │ ├── PID_v1.h │ ├── README.txt │ ├── examples │ │ ├── PID_AdaptiveTunings │ │ │ └── PID_AdaptiveTunings.ino │ │ ├── PID_Basic │ │ │ └── PID_Basic.ino │ │ ├── PID_PonM │ │ │ └── PID_PonM.ino │ │ └── PID_RelayOutput │ │ │ └── PID_RelayOutput.ino │ ├── keywords.txt │ ├── library.json │ └── library.properties ├── QRCode │ ├── .gitignore │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ └── QRCode │ │ │ └── QRCode.ino │ ├── generate_table.py │ ├── keywords.txt │ ├── library.properties │ ├── src │ │ ├── qrcode.c │ │ └── qrcode.h │ └── tests │ │ ├── BitBuffer.cpp │ │ ├── BitBuffer.hpp │ │ ├── QrCode.cpp │ │ ├── QrCode.hpp │ │ ├── QrSegment.cpp │ │ ├── QrSegment.hpp │ │ ├── README.md │ │ ├── run-tests.cpp │ │ └── run.sh ├── README ├── Shell │ ├── README.md │ ├── Shell.c │ ├── Shell.h │ ├── examples │ │ ├── Shell_Basic │ │ │ └── Shell_Basic.ino │ │ ├── Shell_Command_Args │ │ │ └── Shell_Command_Args.ino │ │ ├── Shell_IO_Control │ │ │ └── Shell_IO_Control.ino │ │ ├── Shell_Minimum │ │ │ └── Shell_Minimum.ino │ │ ├── Shell_RGB_Control │ │ │ └── Shell_RGB_Control.ino │ │ └── Shell_Telnet │ │ │ └── Shell_Telnet.ino │ ├── keywords.txt │ ├── library.properties │ └── license.txt └── U8g2 │ ├── LICENSE │ ├── README.md │ ├── examples │ ├── full_buffer │ │ ├── FPS │ │ │ └── FPS.ino │ │ ├── FontUsage │ │ │ └── FontUsage.ino │ │ ├── GraphicsTest │ │ │ └── GraphicsTest.ino │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── IconMenu │ │ │ └── IconMenu.ino │ │ ├── PrintUTF8 │ │ │ └── PrintUTF8.ino │ │ ├── SelectionList │ │ │ └── SelectionList.ino │ │ ├── Shennong │ │ │ └── Shennong.ino │ │ ├── U8g2Logo │ │ │ └── U8g2Logo.ino │ │ ├── UpdateArea │ │ │ └── UpdateArea.ino │ │ └── Weather │ │ │ └── Weather.ino │ ├── games │ │ ├── LittleRookChess │ │ │ └── LittleRookChess.ino │ │ └── SpaceTrash │ │ │ └── SpaceTrash.ino │ ├── page_buffer │ │ ├── A2Printer │ │ │ └── A2Printer.ino │ │ ├── Chinese │ │ │ └── Chinese.ino │ │ ├── ClipWindow │ │ │ └── ClipWindow.ino │ │ ├── Clock │ │ │ └── Clock.ino │ │ ├── ContrastTest │ │ │ └── ContrastTest.ino │ │ ├── Devanagari │ │ │ └── Devanagari.ino │ │ ├── DirectAccess │ │ │ └── DirectAccess.ino │ │ ├── DrawLog │ │ │ └── DrawLog.ino │ │ ├── ExtUTF8 │ │ │ └── ExtUTF8.ino │ │ ├── FPS │ │ │ └── FPS.ino │ │ ├── FlipMode │ │ │ └── FlipMode.ino │ │ ├── GraphicsTest │ │ │ └── GraphicsTest.ino │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── IconMenu │ │ │ └── IconMenu.ino │ │ ├── Japanese │ │ │ └── Japanese.ino │ │ ├── Korean │ │ │ └── Korean.ino │ │ ├── PowerSaveTest │ │ │ └── PowerSaveTest.ino │ │ ├── PrintHelloWorld │ │ │ └── PrintHelloWorld.ino │ │ ├── PrintProgmem │ │ │ └── PrintProgmem.ino │ │ ├── PrintUTF8 │ │ │ └── PrintUTF8.ino │ │ ├── ScrollingText │ │ │ └── ScrollingText.ino │ │ ├── SelectionList │ │ │ └── SelectionList.ino │ │ ├── Serial │ │ │ └── Serial.ino │ │ ├── Shennong │ │ │ └── Shennong.ino │ │ ├── StateBufferLoop │ │ │ └── StateBufferLoop.ino │ │ ├── Terminal │ │ │ └── Terminal.ino │ │ ├── U8g2Logo │ │ │ └── U8g2Logo.ino │ │ ├── UpdatePartly │ │ │ └── UpdatePartly.ino │ │ ├── Weather │ │ │ └── Weather.ino │ │ ├── XBM │ │ │ └── XBM.ino │ │ └── XORTest │ │ │ └── XORTest.ino │ └── u8x8 │ │ ├── 16x16Font │ │ └── 16x16Font.ino │ │ ├── ArduboyTest │ │ └── ArduboyTest.ino │ │ ├── FlipMode │ │ └── FlipMode.ino │ │ ├── GraphicsTest │ │ └── GraphicsTest.ino │ │ ├── HelloWorld │ │ └── HelloWorld.ino │ │ ├── MessageBox │ │ └── MessageBox.ino │ │ └── Terminal │ │ └── Terminal.ino │ ├── extras │ └── ChangeLog │ ├── keywords.txt │ ├── library.properties │ └── src │ ├── U8g2lib.h │ ├── U8x8lib.cpp │ ├── U8x8lib.h │ └── clib │ ├── u8g2.h │ ├── u8g2_bitmap.c │ ├── u8g2_box.c │ ├── u8g2_buffer.c │ ├── u8g2_circle.c │ ├── u8g2_cleardisplay.c │ ├── u8g2_d_memory.c │ ├── u8g2_d_setup.c │ ├── u8g2_font.c │ ├── u8g2_fonts.c │ ├── u8g2_hvline.c │ ├── u8g2_input_value.c │ ├── u8g2_intersection.c │ ├── u8g2_kerning.c │ ├── u8g2_line.c │ ├── u8g2_ll_hvline.c │ ├── u8g2_message.c │ ├── u8g2_polygon.c │ ├── u8g2_selection_list.c │ ├── u8g2_setup.c │ ├── u8log.c │ ├── u8log_u8g2.c │ ├── u8log_u8x8.c │ ├── u8x8.h │ ├── u8x8_8x8.c │ ├── u8x8_byte.c │ ├── u8x8_cad.c │ ├── u8x8_capture.c │ ├── u8x8_d_a2printer.c │ ├── u8x8_d_il3820_296x128.c │ ├── u8x8_d_ist3020.c │ ├── u8x8_d_ist7920.c │ ├── u8x8_d_ks0108.c │ ├── u8x8_d_lc7981.c │ ├── u8x8_d_ld7032_60x32.c │ ├── u8x8_d_ls013b7dh03.c │ ├── u8x8_d_max7219.c │ ├── u8x8_d_pcd8544_84x48.c │ ├── u8x8_d_pcf8812.c │ ├── u8x8_d_pcf8814_hx1230.c │ ├── u8x8_d_s1d15721.c │ ├── u8x8_d_s1d15e06.c │ ├── u8x8_d_sbn1661.c │ ├── u8x8_d_sed1330.c │ ├── u8x8_d_sh1106_64x32.c │ ├── u8x8_d_sh1106_72x40.c │ ├── u8x8_d_sh1107.c │ ├── u8x8_d_sh1108.c │ ├── u8x8_d_sh1122.c │ ├── u8x8_d_ssd1305.c │ ├── u8x8_d_ssd1306_128x32.c │ ├── u8x8_d_ssd1306_128x64_noname.c │ ├── u8x8_d_ssd1306_128x80_noname.c │ ├── u8x8_d_ssd1306_2040x16.c │ ├── u8x8_d_ssd1306_48x64.c │ ├── u8x8_d_ssd1306_64x32.c │ ├── u8x8_d_ssd1306_64x48.c │ ├── u8x8_d_ssd1306_72x40.c │ ├── u8x8_d_ssd1306_96x16.c │ ├── u8x8_d_ssd1309.c │ ├── u8x8_d_ssd1316.c │ ├── u8x8_d_ssd1317.c │ ├── u8x8_d_ssd1318.c │ ├── u8x8_d_ssd1320.c │ ├── u8x8_d_ssd1322.c │ ├── u8x8_d_ssd1325.c │ ├── u8x8_d_ssd1326.c │ ├── u8x8_d_ssd1327.c │ ├── u8x8_d_ssd1329.c │ ├── u8x8_d_ssd1606_172x72.c │ ├── u8x8_d_ssd1607_200x200.c │ ├── u8x8_d_st7511.c │ ├── u8x8_d_st75256.c │ ├── u8x8_d_st7528.c │ ├── u8x8_d_st75320.c │ ├── u8x8_d_st7565.c │ ├── u8x8_d_st7567.c │ ├── u8x8_d_st7571.c │ ├── u8x8_d_st7586s_erc240160.c │ ├── u8x8_d_st7586s_s028hn118a.c │ ├── u8x8_d_st7586s_ymc240160.c │ ├── u8x8_d_st7588.c │ ├── u8x8_d_st7920.c │ ├── u8x8_d_stdio.c │ ├── u8x8_d_t6963.c │ ├── u8x8_d_uc1601.c │ ├── u8x8_d_uc1604.c │ ├── u8x8_d_uc1608.c │ ├── u8x8_d_uc1610.c │ ├── u8x8_d_uc1611.c │ ├── u8x8_d_uc1617.c │ ├── u8x8_d_uc1638.c │ ├── u8x8_d_uc1701_dogs102.c │ ├── u8x8_d_uc1701_mini12864.c │ ├── u8x8_debounce.c │ ├── u8x8_display.c │ ├── u8x8_fonts.c │ ├── u8x8_gpio.c │ ├── u8x8_input_value.c │ ├── u8x8_message.c │ ├── u8x8_selection_list.c │ ├── u8x8_setup.c │ ├── u8x8_string.c │ ├── u8x8_u16toa.c │ └── u8x8_u8toa.c ├── platformio.ini ├── src ├── BLE.cpp ├── Beep.cpp ├── Bezier.cpp ├── Bitmap.cpp ├── Calibration.cpp ├── Event.cpp ├── ExternDraw.cpp ├── FilesSystem.cpp ├── MathFun.cpp ├── Menu.cpp ├── MyShell.cpp ├── Rotary.cpp ├── TODO.md ├── TipControl.cpp ├── TipManager.cpp ├── main.cpp └── serial_putc.cpp └── test └── README /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | .vscode/c_cpp_properties.json 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "*.m": "matlab", 4 | "shell.h": "c" 5 | } 6 | } -------------------------------------------------------------------------------- /README_cn.md: -------------------------------------------------------------------------------- 1 | # 朱雀 是基于ESP32的开源焊台控制器 2 | 3 | [English](README.md) 4 | 5 | [中文](README_cn.md) 6 | 7 | ## 关于 8 | 9 | ![](img/Logo.png) 10 | 11 | 本控制器除了控制普通焊台以外,只需通过稍作修改,还可以控制其他非焊台的自动化设备 12 | 13 | ## 分支项目 14 | 15 | 16 | **[OpenHeat]** 17 | 18 | 稚晖君的智能加热台 19 | 20 | **[开源兼容焊台]** 21 | 22 | By sndnvaps 23 | 24 | ## 硬件 25 | 26 | [LCEDA/EasyEDA]https://oshwhub.com/createskyblue/opent12-jing-jian-ban 27 | [核心驱动电路参考]https://oshwhub.com/47415Y/gong-cheng 28 | 29 | **注意:电路板未完全验证** 30 | **Note: the circuit board is not fully verified** 31 | 32 | ![PCB_V3.0](img/readme/PCB3.0.jpg) 33 | 34 | ## 视频 35 | 36 | ![](img/OLED_ScreenshotInit/爆发.png) 37 | 38 | 39 | ## 使用说明 40 | 41 | - 第一次启动时会进行文件系统格式化,需要一定时间 42 | - 主界面中使用 **单击** 可进入爆发提温模式 43 | - 主界面中使用 **双击** 可呼出PID菜单 44 | - 主界面中使用 **长按** 可打开菜单 45 | - 若有多个烙铁配置,检测到烙铁更换时会在主界面弹出配置选择菜单 46 | - 添加新烙铁配置时,默认参数为空,需要自行校准温度以及设置参数 47 | - 主菜单中 **长按** 可以返回上一级 48 | 49 | ## 功能 50 | 51 | ***对加热系统的兼容*** 52 | 53 | - [x] 深圳T12 54 | - [x] 铝基板PCB热床(第三方分支项目) 55 | - [ ] 高频焊台 (该测试版不支持)(未测试理论可行) 56 | - [ ] 热风枪 (该测试版不支持) 57 | 58 | 59 | ***基本功能*** 60 | 61 | - [x] 支持中文输入 62 | - [x] 多段PID控制加热,多端ADC/PID采样周期设置 63 | - [x] 可设置 开机温度、爆发温度、休眠温度 64 | - [x] 可定时 休眠、关机,自定义爆发模式时间 65 | - [x] 可保存成千上千万组烙铁头配置(默认10组) 66 | - [ ] 双休眠支持:同时支持震动触发与磁力触发 67 | 68 | ***高级功能*** 69 | 70 | - [x] PMOS与NMOS(默认PMOS,由于该选项具有危险性,需要在源程序上修改设置) 71 | - [x] 快捷键快速调节PID 72 | - [x] 每个烙铁头允许设置两组PID 73 | - [x] 可通过菜单设置独立ADC/PID采样周期,卡尔曼滤波器参数 74 | - [x] 9段烙铁头温度拟合校准 75 | - [ ] 温度自校准电路(未实现) 76 | - [x] 自定义显示效果:亮度、翻转平面、过渡动画、显示样式、列表模式 77 | - [x] 个性化自定义:提示音、编码器旋转方向、手柄触发模式、系统语言(暂时只支持简体中文) 78 | - [x] 安全保护设置:自定义开机密码、欠压警报、强制关机提示警告 79 | - [x] 蓝牙远程命令行控制 80 | - [ ] 语音控制(未实现) 81 | - [ ] 自定义开机Logo(未实现) 82 | 83 | ## 引脚定义 84 | 目前硬件还没有设计好,如果想自己制作控制器可以参考下表制作硬件 85 | 86 | **使用I2C(默认)** 87 | | I2C模式 | PIN | SPI模式 | PIN | 88 | | :-----: | :----: | :-----: | :----: | 89 | | 屏幕SCL | 22 | 屏幕SCK | 18 | 90 | | 屏幕SDA | 21 |屏幕MOSI | 23 | 91 | |||屏幕DC | 13 | 92 | |||屏幕RST | 15 | 93 | |||屏幕CS | GND (未来有变动)| 94 | 95 | **其他引脚** 96 | | 名称 | PIN | 97 | | :-----: | :----: | 98 | |LED|2 (保留)| 99 | |蜂鸣器|25| 100 | |编码器A|14| 101 | |编码器B|12| 102 | |编码器按键|33| 103 | |测温ADC|39| 104 | |热敏ADC|34| 105 | |电压ADC|35| 106 | |电流ADC|32| 107 | |PWM1|26| 108 | |PWM2|27(保留)| 109 | |震动开关|4| 110 | |干簧管|19| 111 | 112 | ## 编译安装 113 | 参考platformIO的使用 114 | 115 | ## 展示 116 |
👇主页面
117 | 118 | ![](img/OLED_ScreenshotInit/加热.png) 119 | ![](img/OLED_ScreenshotInit/错误.png) 120 | 121 |
👇支持保存多组不同的独立烙铁头配置(PID与温度系数统统独立)
122 | 123 | ![](img/OLED_ScreenshotInit/配置列表.png) 124 | 125 |
👇9阶温度系数校准
126 | 127 | ![](img/OLED_ScreenshotInit/温度系数.png) 128 | ![](img/OLED_ScreenshotInit/校准页面.png) 129 | 130 |
👇支持中文输入
131 | 132 | ![](img/OLED_ScreenshotInit/重命名.png) 133 | 134 |
👇每个烙铁头可以设置两组PID
135 | 136 | ![](img/OLED_ScreenshotInit/PID.png) 137 | ![](img/OLED_ScreenshotInit/修改PID.png) 138 | 139 |
👇个性化设置
140 | 141 | ![](img/OLED_ScreenshotInit/温度场景.png) 142 | ![](img/OLED_ScreenshotInit/翻转屏幕.png) 143 | ![](img/OLED_ScreenshotInit/密码输入.png) -------------------------------------------------------------------------------- /doc/ESP32引脚定义.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/doc/ESP32引脚定义.webp -------------------------------------------------------------------------------- /doc/菜单最优跳转算法.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/doc/菜单最优跳转算法.xlsx -------------------------------------------------------------------------------- /files/朱雀.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/files/朱雀.pptx -------------------------------------------------------------------------------- /hardware/V1.0/Gerber_PCB_OpenT12_精简.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V1.0/Gerber_PCB_OpenT12_精简.zip -------------------------------------------------------------------------------- /hardware/V2.0/History/精简焊台.~(1).PcbDoc.Zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/History/精简焊台.~(1).PcbDoc.Zip -------------------------------------------------------------------------------- /hardware/V2.0/History/精简焊台.~(2).PcbDoc.Zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/History/精简焊台.~(2).PcbDoc.Zip -------------------------------------------------------------------------------- /hardware/V2.0/PCB_OpenT12_精简_2021-10-27.PcbLib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/PCB_OpenT12_精简_2021-10-27.PcbLib -------------------------------------------------------------------------------- /hardware/V2.0/PCB_Project.PrjPcb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/PCB_Project.PrjPcb -------------------------------------------------------------------------------- /hardware/V2.0/PCB_Project.PrjPcbStructure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/PCB_Project.PrjPcbStructure -------------------------------------------------------------------------------- /hardware/V2.0/PCB_Project.SCHLIB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/PCB_Project.SCHLIB -------------------------------------------------------------------------------- /hardware/V2.0/精简焊台.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/精简焊台.PcbDoc -------------------------------------------------------------------------------- /hardware/V2.0/精简版V5_2021-10-27.schdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.0/精简版V5_2021-10-27.schdoc -------------------------------------------------------------------------------- /hardware/V2.1/ASCII.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/ASCII.PcbDoc -------------------------------------------------------------------------------- /hardware/V2.1/PCB_OpenT12_精简_2021-10-27.PcbLib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/PCB_OpenT12_精简_2021-10-27.PcbLib -------------------------------------------------------------------------------- /hardware/V2.1/PCB_Project.PrjPcb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/PCB_Project.PrjPcb -------------------------------------------------------------------------------- /hardware/V2.1/PCB_Project.PrjPcbStructure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/PCB_Project.PrjPcbStructure -------------------------------------------------------------------------------- /hardware/V2.1/PCB_Project.SCHLIB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/PCB_Project.SCHLIB -------------------------------------------------------------------------------- /hardware/V2.1/Snipaste_2021-11-28_19-11-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/Snipaste_2021-11-28_19-11-10.jpg -------------------------------------------------------------------------------- /hardware/V2.1/精简焊台.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/精简焊台.PcbDoc -------------------------------------------------------------------------------- /hardware/V2.1/精简版V5_2021-10-27.schdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/hardware/V2.1/精简版V5_2021-10-27.schdoc -------------------------------------------------------------------------------- /img/Cursor.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/Cursor.bmp -------------------------------------------------------------------------------- /img/J3F}W4XX_3]NT2K_JGCY}(J.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/J3F}W4XX_3]NT2K_JGCY}(J.jpg -------------------------------------------------------------------------------- /img/Logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/Logo.bmp -------------------------------------------------------------------------------- /img/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/Logo.png -------------------------------------------------------------------------------- /img/Logo.sai2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/Logo.sai2 -------------------------------------------------------------------------------- /img/MainScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/MainScreen.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/PID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/PID.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/修改PID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/修改PID.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/加热.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/加热.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/密码输入.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/密码输入.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/校准页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/校准页面.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/欠压提醒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/欠压提醒.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/温度场景.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/温度场景.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/温度系数.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/温度系数.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/爆发.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/爆发.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/翻转屏幕.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/翻转屏幕.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/配置列表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/配置列表.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/重命名.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/重命名.png -------------------------------------------------------------------------------- /img/OLED_ScreenshotInit/错误.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/OLED_ScreenshotInit/错误.png -------------------------------------------------------------------------------- /img/PixeSymbol2字符映射表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/PixeSymbol2字符映射表.png -------------------------------------------------------------------------------- /img/PixeSymbol3.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/PixeSymbol3.ttf -------------------------------------------------------------------------------- /img/PixeSymbol3字符映射表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/PixeSymbol3字符映射表.png -------------------------------------------------------------------------------- /img/PixeSymbol字符映射表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/PixeSymbol字符映射表.png -------------------------------------------------------------------------------- /img/README.txt: -------------------------------------------------------------------------------- 1 | 感谢 千年板蓝根(github: lihaoyun6) 提供的字体文件以及相关素材!!! 2 | Thanks for the font files and related materials provided by 千年板蓝根 (GitHub: lihaoyun6)!!! -------------------------------------------------------------------------------- /img/c1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c1.png -------------------------------------------------------------------------------- /img/c2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c2.png -------------------------------------------------------------------------------- /img/c3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c3.png -------------------------------------------------------------------------------- /img/c4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c4.png -------------------------------------------------------------------------------- /img/c5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c5.png -------------------------------------------------------------------------------- /img/c6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c6.png -------------------------------------------------------------------------------- /img/c7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/c7.png -------------------------------------------------------------------------------- /img/readme/ArduinoIDE_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/ArduinoIDE_1.jpg -------------------------------------------------------------------------------- /img/readme/ArduinoIDE_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/ArduinoIDE_2.jpg -------------------------------------------------------------------------------- /img/readme/ArduinoIDE_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/ArduinoIDE_3.jpg -------------------------------------------------------------------------------- /img/readme/ArduinoIDE_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/ArduinoIDE_4.jpg -------------------------------------------------------------------------------- /img/readme/ArduinoIDE_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/ArduinoIDE_5.jpg -------------------------------------------------------------------------------- /img/readme/ArduinoIDE_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/ArduinoIDE_6.jpg -------------------------------------------------------------------------------- /img/readme/Esp32_IDE_Set.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/Esp32_IDE_Set.jpg -------------------------------------------------------------------------------- /img/readme/PCB3.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/PCB3.0.jpg -------------------------------------------------------------------------------- /img/readme/Pcb_V1.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/readme/Pcb_V1.0.png -------------------------------------------------------------------------------- /img/休眠.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/休眠.png -------------------------------------------------------------------------------- /img/停机32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/停机32x32.png -------------------------------------------------------------------------------- /img/升温32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/升温32x32.png -------------------------------------------------------------------------------- /img/发热丝-弃.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/发热丝-弃.png -------------------------------------------------------------------------------- /img/指示针.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/指示针.png -------------------------------------------------------------------------------- /img/提升32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/提升32x32.png -------------------------------------------------------------------------------- /img/文本/.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "win", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "D:\\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\\include", 8 | "D:\\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\\include\\opencv2" 9 | ], 10 | "defines": [], 11 | "compilerPath": "gcc", 12 | "cStandard": "c11", 13 | "cppStandard": "c++17", 14 | "intelliSenseMode": "clang-x64" 15 | } 16 | ], 17 | "version": 4 18 | } -------------------------------------------------------------------------------- /img/文本/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "opencv3.4.2 debuge", 7 | "type": "cppdbg", 8 | "request": "launch", 9 | "program": "${workspaceFolder}\\${fileBasenameNoExtension}.exe", 10 | "args": [ 11 | "test.png", 12 | "test", 13 | "f" 14 | ], 15 | "stopAtEntry": true, 16 | "cwd": "${workspaceFolder}", 17 | "environment": [], 18 | "externalConsole": false, 19 | "MIMode": "gdb", 20 | "miDebuggerPath": "gdb", 21 | "setupCommands": [ 22 | { 23 | "description": "为 gdb 启用整齐打印", 24 | "text": "-enable-pretty-printing", 25 | "ignoreFailures": false 26 | } 27 | ], 28 | "preLaunchTask": "opencv3.4.2 compile task" 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /img/文本/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "iostream": "cpp", 4 | "array": "cpp", 5 | "chrono": "cpp", 6 | "algorithm": "cpp" 7 | } 8 | } -------------------------------------------------------------------------------- /img/文本/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "shell", 6 | "label": "opencv3.4.2 compile task", 7 | "command": "g++", 8 | "args": [ 9 | "-g", 10 | "${file}", 11 | "-o", 12 | "${workspaceFolder}\\${fileBasenameNoExtension}.exe", 13 | "-I", 14 | "D:\\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\\include", 15 | "-I", 16 | "D:\\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\\include\\opencv2", 17 | "-L", 18 | "D:\\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\\x64\\mingw\\bin", 19 | "-l", "libopencv_calib3d411", 20 | "-l", "libopencv_core411", 21 | "-l", "libopencv_dnn411", 22 | "-l", "libopencv_features2d411", 23 | "-l", "libopencv_flann411", 24 | "-l", "libopencv_highgui411", 25 | "-l", "libopencv_imgcodecs411", 26 | "-l", "libopencv_imgproc411", 27 | "-l", "libopencv_ml411", 28 | "-l", "libopencv_objdetect411", 29 | "-l", "libopencv_photo411", 30 | "-l", "libopencv_stitching411", 31 | "-l", "libopencv_videoio411", 32 | "-l", "libopencv_video411" 33 | ], 34 | "options": { 35 | "cwd": "D:\\mingw64\\bin" 36 | }, 37 | "problemMatcher": [ 38 | "$gcc" 39 | ], 40 | "group": { 41 | "kind": "build", 42 | "isDefault": true 43 | } 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /img/文本/Back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/Back.png -------------------------------------------------------------------------------- /img/文本/StartTFBitMap.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for %%s in (*.png) do ( 3 | echo %%s 4 | start.exe %%s %%s f>>bitmaps.h 5 | 6 | ) 7 | 8 | pause -------------------------------------------------------------------------------- /img/文本/start.cpp.disable: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | using namespace cv; 6 | int main(int argc, char** argv) { 7 | char default_prefix[] = "image"; 8 | char* prefix = default_prefix; 9 | char* SetcolorAdd; 10 | bool color = 1; 11 | 12 | Mat img = imread(argv[1]); 13 | 14 | prefix = argv[2]; 15 | SetcolorAdd = argv[3]; 16 | 17 | if (*SetcolorAdd == 'f') 18 | color = 0; 19 | 20 | Mat channels[3]; 21 | split(img, channels); 22 | 23 | // cv::imshow("image", channels[0]); 24 | printf("const PROGMEM uint8_t %s[] = {", prefix); 25 | 26 | int Abyte = 0, Check, count = 0, countI = 1; 27 | for (int i = 0; i < channels[0].cols * channels[0].rows; i++) { 28 | if (channels[0].at(i)) { 29 | if (color) 30 | Abyte |= 1; 31 | } else if (!color) 32 | Abyte |= 1; 33 | 34 | if (count == 7) { 35 | if (countI % 4 == 0) { 36 | Abyte >>= 4; 37 | Abyte <<= 4; 38 | i -= 4; 39 | } 40 | printf("0x%02x,", Abyte); 41 | countI++; 42 | Abyte = 0; 43 | count = 0; 44 | } else { 45 | count++; 46 | Abyte <<= 1; 47 | } 48 | } 49 | if (count == 4) { 50 | Abyte <<= 3; 51 | printf("0x%02x,", Abyte); 52 | } 53 | printf("};\n"); 54 | 55 | return 0; 56 | } -------------------------------------------------------------------------------- /img/文本/start.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/start.exe -------------------------------------------------------------------------------- /img/文本/t0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t0.png -------------------------------------------------------------------------------- /img/文本/t1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t1.png -------------------------------------------------------------------------------- /img/文本/t19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t19.png -------------------------------------------------------------------------------- /img/文本/t1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t1_1.png -------------------------------------------------------------------------------- /img/文本/t1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t1_2.png -------------------------------------------------------------------------------- /img/文本/t1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t1_3.png -------------------------------------------------------------------------------- /img/文本/t1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t1_4.png -------------------------------------------------------------------------------- /img/文本/t2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t2.png -------------------------------------------------------------------------------- /img/文本/t2_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t2_0.png -------------------------------------------------------------------------------- /img/文本/t2_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t2_1.png -------------------------------------------------------------------------------- /img/文本/t2_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t2_2.png -------------------------------------------------------------------------------- /img/文本/t3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t3.png -------------------------------------------------------------------------------- /img/文本/t4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t4.png -------------------------------------------------------------------------------- /img/文本/t4f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t4f.png -------------------------------------------------------------------------------- /img/文本/t5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t5.png -------------------------------------------------------------------------------- /img/文本/t5_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t5_0.png -------------------------------------------------------------------------------- /img/文本/t5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t5_1.png -------------------------------------------------------------------------------- /img/文本/t5_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t5_3.png -------------------------------------------------------------------------------- /img/文本/t6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t6.png -------------------------------------------------------------------------------- /img/文本/t7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t7.png -------------------------------------------------------------------------------- /img/文本/tAbout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/tAbout.png -------------------------------------------------------------------------------- /img/文本/tPassword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/tPassword.png -------------------------------------------------------------------------------- /img/文本/t_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_4.png -------------------------------------------------------------------------------- /img/文本/t_CN_CN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_CN_CN.png -------------------------------------------------------------------------------- /img/文本/t_CN_EN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_CN_EN.png -------------------------------------------------------------------------------- /img/文本/t_CN_JP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_CN_JP.png -------------------------------------------------------------------------------- /img/文本/t_NO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_NO.png -------------------------------------------------------------------------------- /img/文本/t_OK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_OK.png -------------------------------------------------------------------------------- /img/文本/t_PID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_PID.png -------------------------------------------------------------------------------- /img/文本/t_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_off.png -------------------------------------------------------------------------------- /img/文本/t_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_on.png -------------------------------------------------------------------------------- /img/文本/t_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/文本/t_save.png -------------------------------------------------------------------------------- /img/无.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/无.png -------------------------------------------------------------------------------- /img/朱雀_复古.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/朱雀_复古.png -------------------------------------------------------------------------------- /img/标签.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/标签.png -------------------------------------------------------------------------------- /img/正常32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/正常32x32.png -------------------------------------------------------------------------------- /img/温度计.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/温度计.png -------------------------------------------------------------------------------- /img/维持32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/维持32x32.png -------------------------------------------------------------------------------- /img/芯片16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/芯片16x16.png -------------------------------------------------------------------------------- /img/菜单树.sai2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/菜单树.sai2 -------------------------------------------------------------------------------- /img/蓝牙.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/蓝牙.png -------------------------------------------------------------------------------- /img/设置/BLE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/BLE.png -------------------------------------------------------------------------------- /img/设置/IMG_Animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Animation.png -------------------------------------------------------------------------------- /img/设置/IMG_Animation_DISABLE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Animation_DISABLE.png -------------------------------------------------------------------------------- /img/设置/IMG_Files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Files.png -------------------------------------------------------------------------------- /img/设置/IMG_Flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Flip.png -------------------------------------------------------------------------------- /img/设置/IMG_ListMode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_ListMode.png -------------------------------------------------------------------------------- /img/设置/IMG_Load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Load.png -------------------------------------------------------------------------------- /img/设置/IMG_Pen.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Pen.bmp -------------------------------------------------------------------------------- /img/设置/IMG_Pen2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Pen2.png -------------------------------------------------------------------------------- /img/设置/IMG_ReedSwitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_ReedSwitch.png -------------------------------------------------------------------------------- /img/设置/IMG_Size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Size.png -------------------------------------------------------------------------------- /img/设置/IMG_Sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Sun.png -------------------------------------------------------------------------------- /img/设置/IMG_Tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_Tip.png -------------------------------------------------------------------------------- /img/设置/IMG_VibrationSwitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/IMG_VibrationSwitch.png -------------------------------------------------------------------------------- /img/设置/Lang_CN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Lang_CN.png -------------------------------------------------------------------------------- /img/设置/Lang_EN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Lang_EN.png -------------------------------------------------------------------------------- /img/设置/Lang_JP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Lang_JP.png -------------------------------------------------------------------------------- /img/设置/Load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Load.png -------------------------------------------------------------------------------- /img/设置/Set0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set0.png -------------------------------------------------------------------------------- /img/设置/Set1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set1.png -------------------------------------------------------------------------------- /img/设置/Set10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set10.png -------------------------------------------------------------------------------- /img/设置/Set11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set11.png -------------------------------------------------------------------------------- /img/设置/Set12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set12.png -------------------------------------------------------------------------------- /img/设置/Set13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set13.png -------------------------------------------------------------------------------- /img/设置/Set14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set14.png -------------------------------------------------------------------------------- /img/设置/Set15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set15.png -------------------------------------------------------------------------------- /img/设置/Set16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set16.png -------------------------------------------------------------------------------- /img/设置/Set17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set17.png -------------------------------------------------------------------------------- /img/设置/Set18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set18.png -------------------------------------------------------------------------------- /img/设置/Set19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set19.png -------------------------------------------------------------------------------- /img/设置/Set2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set2.png -------------------------------------------------------------------------------- /img/设置/Set3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set3.png -------------------------------------------------------------------------------- /img/设置/Set4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set4.png -------------------------------------------------------------------------------- /img/设置/Set4F.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set4F.png -------------------------------------------------------------------------------- /img/设置/Set4FF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set4FF.png -------------------------------------------------------------------------------- /img/设置/Set5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set5.png -------------------------------------------------------------------------------- /img/设置/Set5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set5_1.png -------------------------------------------------------------------------------- /img/设置/Set6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set6.png -------------------------------------------------------------------------------- /img/设置/Set7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set7.png -------------------------------------------------------------------------------- /img/设置/Set8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set8.png -------------------------------------------------------------------------------- /img/设置/Set9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set9.png -------------------------------------------------------------------------------- /img/设置/Set_LANG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Set_LANG.png -------------------------------------------------------------------------------- /img/设置/Trigger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/Trigger.png -------------------------------------------------------------------------------- /img/设置/c_NO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/c_NO.png -------------------------------------------------------------------------------- /img/设置/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置/save.png -------------------------------------------------------------------------------- /img/设置16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/设置16x16.png -------------------------------------------------------------------------------- /img/过场.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/过场.png -------------------------------------------------------------------------------- /img/过场1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/过场1.png -------------------------------------------------------------------------------- /img/过场2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/过场2.png -------------------------------------------------------------------------------- /img/错误32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/错误32x32.png -------------------------------------------------------------------------------- /img/闪电16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/img/闪电16x16.png -------------------------------------------------------------------------------- /include/BLE.h: -------------------------------------------------------------------------------- 1 | #ifndef BLE_H 2 | #define BLE_H 3 | #include "Type.h" 4 | 5 | extern char BLE_name[20]; 6 | extern uint8_t BLE_State; 7 | 8 | void BLE_Init(void); 9 | void BLE_Restart(void); 10 | void BLE_Rename(void); 11 | 12 | #endif -------------------------------------------------------------------------------- /include/Beep.h: -------------------------------------------------------------------------------- 1 | #ifndef BEEP_H 2 | #define BEEP_H 3 | #include "Type.h" 4 | 5 | enum CALCULATORMUSICTONE { 6 | CMT_NULL = 255, 7 | CMT_1 = 0, 8 | CMT_2 = 2, 9 | CMT_3 = 3, 10 | CMT_4 = 5, 11 | CMT_5 = 7, 12 | CMT_6 = 9, 13 | CMT_7 = 11, 14 | CMT_8 = 12, 15 | CMT_9 = 14, 16 | CMT_P = 15, 17 | CMT_S = 17, 18 | CMT_M = 18, 19 | CMT_D = 21, 20 | CMT_E = 22, 21 | }; 22 | struct TONE 23 | { 24 | note_t note; 25 | uint8_t rp; 26 | uint16_t delay; 27 | }; 28 | extern TONE testSound[]; 29 | extern TONE BootSound[]; 30 | extern TONE TipInstall[]; 31 | extern TONE TipRemove[]; 32 | extern TONE Beep1[]; 33 | extern TONE Beep2[]; 34 | extern TONE Beep3[]; 35 | 36 | extern uint32_t PlayTonesTimer; 37 | extern uint16_t PlayTonesDelayTime; 38 | extern uint16_t PlayTones_Schedule; 39 | extern TONE* MySound; 40 | 41 | extern bool PlaySoundLoopState; 42 | //底层函数 43 | void BeepInit(void); 44 | void SetTone(double freq); 45 | double GetNote(note_t note, uint8_t rp); 46 | void SetNote(note_t note, uint8_t rp); 47 | //高层应用 48 | void SetSound(TONE sound[]); 49 | void PlaySoundLoop(void); 50 | uint8_t PlayTones(TONE sound[], uint16_t* Schedule); 51 | 52 | #endif -------------------------------------------------------------------------------- /include/Bezier.h: -------------------------------------------------------------------------------- 1 | #ifndef Bezier_H 2 | #define Bezier_H 3 | void RunSleepLoop(void); 4 | #endif -------------------------------------------------------------------------------- /include/Bitmap.h: -------------------------------------------------------------------------------- 1 | #ifndef BITMAP_H 2 | #define BITMAP_H 3 | #include "Type.h" 4 | 5 | //128x64 6 | extern uint8_t Logo[]; 7 | // width: 170, height: 128 8 | extern uint8_t Logo2[]; 9 | 10 | extern uint8_t Logo_RoboBrave[]; 11 | 12 | extern uint8_t TranAnimation[]; 13 | extern uint8_t TranAnimation2[]; 14 | 15 | extern uint8_t QRC[]; 16 | extern uint8_t Set0[]; 17 | extern uint8_t Set1[]; 18 | extern uint8_t Set2[]; 19 | extern uint8_t Set3[]; 20 | extern uint8_t Set4[]; 21 | extern uint8_t Set4F[]; 22 | extern uint8_t Set4FF[]; 23 | extern uint8_t Set5[]; 24 | extern uint8_t Set5_1[]; 25 | extern uint8_t Set6[]; 26 | extern uint8_t Set_LANG[]; 27 | extern uint8_t Set7[]; 28 | extern uint8_t Set11[]; 29 | extern uint8_t Set8[]; 30 | extern uint8_t Set9[]; 31 | extern uint8_t Set10[]; 32 | extern uint8_t Set13[]; 33 | extern uint8_t Set12[]; 34 | extern uint8_t Set14[]; 35 | extern uint8_t Set15[]; 36 | extern uint8_t Set16[]; 37 | extern uint8_t Set17[]; 38 | extern uint8_t Set18[]; 39 | extern uint8_t Lang_CN[]; 40 | extern uint8_t Lang_EN[]; 41 | extern uint8_t Lang_JP[]; 42 | extern uint8_t Save[]; 43 | extern uint8_t Load[]; 44 | extern uint8_t Lock[]; 45 | extern uint8_t Set19[]; 46 | extern uint8_t IMG_Pen[]; 47 | extern uint8_t IMG_Pen2[]; 48 | extern uint8_t IMG_Tip[]; 49 | extern uint8_t IMG_Files[]; 50 | extern uint8_t IMG_Flip[]; 51 | extern uint8_t IMG_Sun[]; 52 | extern uint8_t IMG_Size[]; 53 | extern uint8_t IMG_Animation[]; 54 | extern uint8_t IMG_Animation_DISABLE[]; 55 | extern uint8_t IMG_Trigger[]; 56 | extern uint8_t IMG_VibrationSwitch[]; 57 | extern uint8_t IMG_ReedSwitch[]; 58 | extern uint8_t IMG_BLE[]; 59 | extern uint8_t IMG_ListMode[]; 60 | 61 | extern uint8_t IMG_Load[]; 62 | extern uint8_t PositioningCursor[]; 63 | extern uint8_t Pointer[]; 64 | extern uint8_t Lightning[]; 65 | extern uint8_t Battery_NoPower[]; 66 | extern uint8_t IMG_BLE_S[]; 67 | //状态提示图标 68 | //width:14,height:14 69 | extern uint8_t c1[]; 70 | extern uint8_t c2[]; 71 | extern uint8_t c3[]; 72 | extern uint8_t c5[]; 73 | extern uint8_t c6[]; 74 | extern uint8_t c7[]; 75 | extern uint8_t* C_table[]; 76 | 77 | #endif -------------------------------------------------------------------------------- /include/Calibration.h: -------------------------------------------------------------------------------- 1 | #ifndef Calibration_H 2 | #define Calibration_H 3 | #include "Type.h" 4 | //温度拟合 5 | /* 6 | 50-50 7 | 100-70 8 | 150-134 9 | 200-221 10 | 250-300 11 | 300-379 12 | 350-460 13 | 400-520 14 | 450-579 15 | */ 16 | 17 | //温度拟合经验常数:按照实际情况通过拟合得到 18 | #define TempP1 12.41663913 19 | #define TempP2 0.17561473 20 | #define TempP3 -0.00004794 21 | #define TempP4 0.00000001 22 | 23 | #define FixNum 10 24 | extern double PTemp[FixNum]; //温度拟合系数 25 | extern long Calibration_Base[FixNum]; 26 | extern long Calibration_Input[FixNum]; 27 | 28 | void ShowCurveCoefficient(void); 29 | void DrawTempCurve(void); 30 | void CalibrationTemperature(void); 31 | void gauss_solve(long n, double A[], double x[], double b[]); 32 | void polyfit(long n, long x[], long y[], long poly_n, double p[]); 33 | #endif -------------------------------------------------------------------------------- /include/Event.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSEvent_H 2 | #define SYSEvent_H 3 | #include "Type.h" 4 | 5 | extern uint32_t BoostTimer; 6 | 7 | extern uint32_t EventTimerUpdate; 8 | void TimerUpdateEvent(void); 9 | 10 | void BoostButton_EventLoop(void); 11 | void FastPID_MenuSummon_EventLoop(void); 12 | void ShutdownEventLoop(void); 13 | 14 | bool EnterPasswd(void); 15 | void SetPasswd(void); 16 | 17 | void TimerEventLoop(void); 18 | void SYS_StateCode_Update(void); 19 | 20 | void SW_IRQHandler(void); 21 | void SW_WakeLOOP(void); 22 | #endif -------------------------------------------------------------------------------- /include/ExternDraw.h: -------------------------------------------------------------------------------- 1 | #ifndef ExternDraw 2 | #define ExternDraw 3 | #include "Type.h" 4 | 5 | void EnterLogo(void); 6 | 7 | extern uint8_t DisplayFlashTick; 8 | void Clear(void); 9 | void Display(void); 10 | 11 | void Draw_Utf(int x, int y, const char* s); 12 | void Blur(int sx, int sy, int ex, int ey, int f, int delay); 13 | void Draw_Scale(int x, int y, int w, int h, int s, int v); 14 | void Draw_Num_Bar(float i, float a, float b, int x, int y, int w, int h, int c); 15 | void Draw_Pixel_Resize(int x, int y, int ox, int oy, int w, int h); 16 | void Draw_Slow_Bitmap(int x, int y, const unsigned char* bitmap, unsigned char w, unsigned char h); 17 | void Draw_Slow_Bitmap_Resize(int x, int y, uint8_t* bitmap, int w1, int h1, int w2, int h2); 18 | void DrawStatusBar(bool color); 19 | 20 | void DrawIntensiveComputingLine(void); 21 | void DrawIntensiveComputing(void); 22 | 23 | void DrawMsgBox(const char* s); 24 | void DrawHighLightText(int x, int y, const char* s); 25 | 26 | 27 | void TextEditor(const char* title, char* text); 28 | #endif -------------------------------------------------------------------------------- /include/FilesSystem.h: -------------------------------------------------------------------------------- 1 | #ifndef FILESSYSTEM_H 2 | #define FILESSYSTEM_H 3 | #include "Type.h" 4 | #include "FS.h" 5 | #include "SPIFFS.h" 6 | 7 | extern char SYS_SVAE_PATH[]; 8 | 9 | void FilesSystemInit(void); 10 | 11 | void SYS_Save(void); 12 | void SYS_Load(void); 13 | 14 | void listDir(fs::FS& fs, const char* dirname, uint8_t levels); 15 | void readFile(fs::FS& fs, const char* path); 16 | void writeFile(fs::FS& fs, const char* path, const char* message); 17 | void appendFile(fs::FS& fs, const char* path, const char* message); 18 | void renameFile(fs::FS& fs, const char* path1, const char* path2); 19 | void deleteFile(fs::FS& fs, const char* path); 20 | void testFileIO(fs::FS& fs, const char* path); 21 | #endif -------------------------------------------------------------------------------- /include/MathFun.h: -------------------------------------------------------------------------------- 1 | #ifndef MathFun_H 2 | #define MathFun_H 3 | #include "Type.h" 4 | int get_Dec_Bit(int x, int n); 5 | int Get_Dec_Deep(int x); 6 | int Get_Int_Bit_Sum(int x); 7 | uint32_t Get_UTF8_Ascii_Pix_Len(uint8_t size, const char* s); 8 | uint32_t UTF8_HMiddle(uint32_t x, uint32_t w, uint8_t size, const char* s); 9 | uint32_t Minute2Millis(float min); 10 | 11 | void ShowBuffer(uint8_t* buffer, uint32_t size); 12 | 13 | //卡尔曼滤波 14 | typedef struct 15 | { 16 | float LastP;//上次估算协方差 初始化值为0.02 17 | float Now_P;//当前估算协方差 初始化值为0 18 | float out;//卡尔曼滤波器输出 初始化值为0 19 | float Kg;//卡尔曼增益 初始化值为0 20 | float Q;//过程噪声协方差 初始化值为0.001 21 | float R;//观测噪声协方差 初始化值为0.543 22 | }KFP;//Kalman Filter parameter 23 | float kalmanFilter(KFP *kfp,float input); 24 | 25 | double ESP32_ADC2Vol(uint16_t adc); 26 | int sign(int x); 27 | 28 | #endif -------------------------------------------------------------------------------- /include/Menu.h: -------------------------------------------------------------------------------- 1 | #ifndef __MENU_H 2 | #define __MENU_H 3 | #include 4 | #include "Type.h" 5 | 6 | extern uint8_t Menu_System_State; 7 | extern uint32_t pages_Tip_Display_timer; 8 | extern uint8_t Menu_JumpAndExit; 9 | extern uint8_t Menu_JumpAndExit_Level; 10 | 11 | void System_TipMenu_Init(void); 12 | void System_PIDMenu_Init(void); 13 | void System_Menu_Init(void); 14 | void System_UI_Init(void); 15 | void System_UI(void); 16 | 17 | int Get_Real_Menu_Level_Id(uint8_t id); 18 | int Get_Menu_Id(uint8_t lid, uint8_t id); 19 | 20 | 21 | void Menu_Control(void); 22 | void Draw_APP(int x, int y, char* bitmap); 23 | void Page_Footnotes(int a, int b); 24 | void Text_Reader(char* s); 25 | void Run_Menu_Id(uint8_t lid, uint8_t id); 26 | void Next_Menu(void); 27 | void Pop_Windows(const char* s); 28 | void Exit_Menu_System(void); 29 | void Save_Exit_Menu_System(void); 30 | void JumpWithTitle(void); 31 | void SmoothAnimationSystem_Clean(void); 32 | 33 | void Smooth_Animation_System(void); 34 | 35 | void Update_OLED_Light_Level(void); 36 | void Update_OLED_Flip(void); 37 | 38 | void PopMsg_RotaryDirection(void); 39 | void PopMsg_ScreenFlip(void); 40 | void PopMsg_ListMode(void); 41 | void SYS_About(void); 42 | 43 | /* 44 | @名称 Smooth_Animation 45 | @变量 46 | x 过渡值 47 | last 上次的值 48 | val 目标值 49 | w 平滑权重 50 | */ 51 | struct Smooth_Animation { 52 | float x; //过渡值 53 | int last; //上次的值 54 | int val; //目标值 55 | float w; //平滑权重 56 | uint8_t a; //是否允许累加 57 | uint8_t b; //选择过渡动画计算函数 58 | }; 59 | extern struct Smooth_Animation Menu_Smooth_Animation[]; 60 | /* 61 | @名称 Slide_Bar 62 | @变量 63 | x 值 64 | min 最小值 65 | max 最大值 66 | step 步进 67 | */ 68 | struct Slide_Bar { 69 | float* x; //值 70 | float min; 71 | float max; 72 | float step; 73 | }; 74 | extern struct Slide_Bar Slide_space[]; 75 | 76 | struct Menu_Level_System { 77 | uint8_t id; //当前层id 78 | int x; //当前层所指选项 79 | uint8_t min; //最小页 80 | uint8_t max; //最大页 81 | uint8_t a; //参数A 0:无动作 1:开启图标化菜单 82 | }; 83 | 84 | struct Menu_System { 85 | uint8_t lid; //层id 86 | uint8_t id; //选项id 87 | uint8_t x; //执行操作 0-跳转到菜单 1-执行函数 2-菜单名 3-开关控件 4-滑动条控件 88 | const char* name; //选项名称 89 | uint8_t* icon; 90 | uint8_t a; //附加参数_1 (0-jump_Level_id) (3-开关id) (4-滑动条id) 91 | uint8_t b; //附加参数_2 (0-jump_id) (4-滑动条:true?执行函数:无操作) 92 | void (*function)(); 93 | }; 94 | 95 | extern struct Menu_System Menu[]; 96 | extern struct Menu_Level_System MenuLevel[]; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /include/MyShell.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSHELL_H 2 | #define MYSHELL_H 3 | #include "Type.h" 4 | 5 | extern uint8_t EasyCursor[10][2]; 6 | extern uint8_t OLED_ScreenshotFlag; 7 | 8 | void shellInit(void); 9 | void ShellLoop(void); 10 | int shell_reader(char* data); 11 | void shell_writer(char data); 12 | void shell_SendDatas(uint8_t buf[], uint32_t size); //发送协议包数据 13 | int command_test(int argc, char** argv); 14 | 15 | void OLED_ScreenshotInit(void); 16 | void OLED_ScreenshotPrint(void); 17 | #endif -------------------------------------------------------------------------------- /include/OpenT12.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENT12_H 2 | #define OPENT12_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "BluetoothSerial.h" 11 | #include "Type.h" 12 | #include "serial_putc.h" 13 | #include "MyShell.h" 14 | #include "Rotary.h" 15 | #include "MathFun.h" 16 | #include "ExternDraw.h" 17 | #include "Event.h" 18 | #include "Menu.h" 19 | #include "Calibration.h" 20 | #include "TipControl.h" 21 | #include "Beep.h" 22 | #include "Bezier.h" 23 | #include "TipManager.h" 24 | #include "FilesSystem.h" 25 | #include "qrcode.h" 26 | #include "BLE.h" 27 | #include "Bitmap.h" 28 | 29 | #define setbit(x,y) x|=(1<> (y)&1) 33 | 34 | //注意Pin36与Pin39连接了内部霍尔传感器,不建议复用高敏感用途 35 | //另外,建议给ADC输入串联一个0.1uF的电容,有利于减少噪声 36 | #define LED_Pin 2 37 | #define BEEP_PIN 25 38 | 39 | #define ROTARY_PIN1 14 40 | #define ROTARY_PIN2 12 41 | #define BUTTON_PIN 33 42 | 43 | #define TIP_ADC_PIN 39 44 | #define NTC_ADC_PIN 34 45 | #define POWER_ADC_PIN 35 46 | #define CUR_ADC_PIN 32 47 | 48 | #define PWM1_PIN 26 49 | #define PWM2_PIN 27 50 | #define SW_PIN 4 51 | 52 | //计算主电源电压 53 | #define POWER_ADC_VCC_R1 10 54 | #define POWER_ADC_R2_GND 1 55 | 56 | //检流电阻参数 57 | #define CUR_ADC_R 0.02 58 | #define CUR_ADC_Arate 21.0 59 | 60 | //NTC参数 61 | #define K2C 273.15 62 | #define NTC_B 3950 63 | #define NTC_Tc 25 64 | #define NTC_Rs 10000 65 | 66 | #define CNSize 12 67 | #define SCREEN_COLUMN 128 68 | #define SCREEN_ROW 64 69 | #define SCREEN_PAGE_NUM 8 70 | #define SCREEN_FONT_ROW 4 71 | 72 | //温度限制 73 | #define TipMaxTemp 450 74 | #define TipMinTemp 0 75 | 76 | //烙铁安装移除事件计时器冷却时间:防止事件临界值抖动 77 | #define TipEvent_CoolTime 1500 78 | //到温提示声播放稳定期:防止温度没有稳定下来就播放到温音效 79 | #define TempToneStabilitytime 1000 80 | 81 | enum SYSLANG { 82 | LANG_English = 0, 83 | LANG_Chinese, 84 | LANG_Russian, 85 | }; 86 | 87 | enum PANELSET { 88 | PANELSET_Simple = 0, 89 | PANELSET_Detailed, 90 | }; 91 | 92 | enum HANDLETRIGGER { 93 | HANDLETRIGGER_VibrationSwitch = 0, 94 | HANDLETRIGGER_ReedSwitch, 95 | }; 96 | 97 | enum MESSAGETYPE { 98 | LOG_INFO = 0, 99 | LOG_OK, 100 | LOG_FAILED, 101 | LOG_WARNING, 102 | LOG_ERROR, 103 | }; 104 | 105 | void Log(MESSAGETYPE type, const char* s); 106 | void SYS_Reboot(void); 107 | void About(void); 108 | 109 | 110 | extern uint64_t ChipMAC; 111 | extern char ChipMAC_S[19]; 112 | extern char CompileTime[20]; 113 | 114 | extern hw_timer_t* SoundTimer; 115 | 116 | extern BluetoothSerial SerialBT; 117 | extern OneButton RButton; 118 | extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C Disp; 119 | // extern U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI Disp; 120 | // extern U8G2_ST7920_128X64_F_HW_SPI Disp; 121 | // extern U8G2_ST7920_128X64_F_SW_SPI Disp; 122 | extern PID MyPID; 123 | extern KFP KFP_Temp; 124 | 125 | extern uint8_t DEBUG_MODE; 126 | 127 | extern char* TipName; 128 | 129 | extern float BootTemp; 130 | extern float SleepTemp; 131 | extern float ScreenProtectorTime; 132 | extern float BoostTemp; 133 | 134 | extern float ShutdownTime; 135 | extern float SleepTime; 136 | extern float BoostTime; 137 | 138 | extern bool SYS_Ready; 139 | 140 | extern bool TipInstallEvent; 141 | extern bool TipCallSleepEvent; 142 | extern bool TempToneFlag; 143 | extern bool SleepScreenProtectFlag; 144 | 145 | extern bool ERROREvent; 146 | extern bool ShutdownEvent; 147 | extern bool SleepEvent; 148 | extern bool BoostEvent; 149 | extern bool UnderVoltageEvent; 150 | 151 | extern bool PWM_WORKY; 152 | 153 | 154 | extern uint8_t PIDMode; 155 | extern uint8_t Use_KFP; 156 | 157 | extern uint8_t PanelSettings; 158 | extern uint8_t ScreenFlip; 159 | extern uint8_t SmoothAnimation_Flag; 160 | extern float ScreenBrightness; 161 | extern uint8_t OptionStripFixedLength_Flag; 162 | 163 | extern uint8_t Volume; 164 | extern uint8_t RotaryDirection; 165 | extern uint8_t HandleTrigger; 166 | 167 | extern double SYS_Voltage; 168 | extern double SYS_Current; 169 | extern double NTC_Temp; 170 | extern float UndervoltageAlert; 171 | extern char BootPasswd[20]; 172 | extern uint8_t Language; 173 | extern uint8_t MenuListMode; 174 | 175 | extern float ADC_PID_Cycle; 176 | 177 | enum TEMP_CTRL_STATUS_CODE { 178 | TEMP_STATUS_ERROR = 0, 179 | TEMP_STATUS_OFF, 180 | TEMP_STATUS_SLEEP, 181 | TEMP_STATUS_BOOST, 182 | TEMP_STATUS_WORKY, 183 | TEMP_STATUS_HEAT, 184 | TEMP_STATUS_HOLD, 185 | }; 186 | extern uint8_t TempCTRL_Status; 187 | extern char* TempCTRL_Status_Mes[]; 188 | 189 | 190 | 191 | #endif -------------------------------------------------------------------------------- /include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /include/Rotary.h: -------------------------------------------------------------------------------- 1 | #ifndef sys_Counter_H 2 | #define sys_Counter_H 3 | #include 4 | #include "Type.h" 5 | 6 | #define ROTARY_TYPE 2 7 | 8 | extern uint8_t SYSKey; 9 | extern bool Counter_LOCK_Flag; 10 | 11 | void sys_RotaryInit(void); 12 | void sys_Counter_Set(double min, double max, double step, double c); 13 | void sys_Counter_SetVal(double c); 14 | void RotaryUp(void); 15 | void RotaryDown(void); 16 | 17 | void sys_Counter_click(void); 18 | void sys_Counter_doubleclick(void); 19 | void sys_Counter_longclick(void); 20 | void sys_Counter_IRQHandler(void); 21 | double sys_Counter_Get(void); 22 | uint8_t sys_Counter_Change(void); 23 | 24 | void Clear_RButton_FIFO(void); 25 | uint8_t sys_KeyProcess(void); 26 | #endif -------------------------------------------------------------------------------- /include/TipControl.h: -------------------------------------------------------------------------------- 1 | #ifndef TipControl_H 2 | #define TipControl_H 3 | #include "Type.h" 4 | 5 | extern uint8_t MyMOS; 6 | extern uint8_t POWER; 7 | extern uint8_t PWM; 8 | extern uint8_t LastPWM; 9 | extern uint16_t LastADC; 10 | extern double UserSetTipTemperature; 11 | extern double TipTemperature; 12 | extern double PID_Output; 13 | extern double PID_Setpoint; 14 | extern double TempGap; 15 | 16 | extern float SamplingRatioWork; 17 | extern float ADC_PID_Cycle_List[3]; 18 | 19 | extern float aggKp, aggKi, aggKd; 20 | extern float consKp, consKi, consKd; 21 | 22 | extern uint8_t PWMOutput_Lock; 23 | 24 | extern double Get_MainPowerVoltage(void); 25 | extern double GetCurrent(void); 26 | extern double GetNTCTemp(void); 27 | 28 | void TipControlInit(void); 29 | void SetPOWER(uint8_t power); 30 | void PWMOutput(uint8_t pwm); 31 | uint16_t GetADC0(void); 32 | double CalculateTemp(double ADC, double P[]); 33 | 34 | void TemperatureControlLoop(void); 35 | 36 | #endif -------------------------------------------------------------------------------- /include/TipManager.h: -------------------------------------------------------------------------------- 1 | #ifndef TIPMANAGER_H 2 | #define TIPMANAGER_H 3 | #include "Type.h" 4 | 5 | //最大烙铁头配置数量 6 | #define MaxTipConfig 10 7 | extern uint8_t TipID; //当前选择的烙铁头 8 | extern uint8_t TipTotal; //有效烙铁头配置总数 9 | 10 | struct TIPCONFIG 11 | { 12 | double PTemp[4]; //温度系数 13 | float PID[2][3]; //PID系数{远PID,近PID} 14 | char name[20]; //名称 15 | }; 16 | 17 | extern TIPCONFIG MyTip[MaxTipConfig]; 18 | 19 | void LoadTipConfig(void); 20 | void SaveTipConfig(void); 21 | 22 | void FlashTipMenu(void); 23 | 24 | void NewTipConfig(void); 25 | void TipRename(void); 26 | void TipDel(void); 27 | 28 | #endif -------------------------------------------------------------------------------- /include/Type.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPE_H 2 | #define TYPE_H 3 | #include 4 | static const uint8_t D0 = 16; 5 | static const uint8_t D1 = 5; 6 | static const uint8_t D2 = 4; 7 | static const uint8_t D3 = 0; 8 | static const uint8_t D4 = 2; 9 | static const uint8_t D5 = 14; 10 | static const uint8_t D6 = 12; 11 | static const uint8_t D7 = 13; 12 | static const uint8_t D8 = 15; 13 | static const uint8_t D9 = 3; 14 | static const uint8_t D10 = 1; 15 | 16 | #endif -------------------------------------------------------------------------------- /include/serial_putc.h: -------------------------------------------------------------------------------- 1 | #ifndef PRINTF_H 2 | #define PRINTF_H 3 | int fputc(int ch, FILE* f); 4 | #endif -------------------------------------------------------------------------------- /lib/OneButton/.github/workflows/arduino-checks.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions for Arduino library projects 2 | 3 | name: Arduino Library Checks 4 | 5 | # Controls when the action will run. 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the develop branch 8 | push: 9 | branches: [develop,master] 10 | pull_request: 11 | branches: [develop,master] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | jobs: 17 | 18 | # This defines a job for checking the Arduino library format specifications 19 | # see 20 | lint: 21 | name: check library format 22 | runs-on: ubuntu-latest 23 | continue-on-error: true 24 | 25 | steps: 26 | - uses: actions/checkout@v2 27 | 28 | # Arduino - lint 29 | - name: Arduino-lint 30 | uses: arduino/arduino-lint-action@v1 31 | with: 32 | library-manager: update 33 | verbose: false 34 | 35 | # These jobs are used to compile the examples fot the specific processor/board. 36 | # see 37 | compile-uno: 38 | name: compile uno examples 39 | runs-on: ubuntu-latest 40 | continue-on-error: true 41 | 42 | steps: 43 | - uses: actions/checkout@v2 44 | 45 | # Compile Examples for UNO 46 | - name: Compile examples on uno 47 | uses: arduino/compile-sketches@v1 48 | with: 49 | verbose: true 50 | fqbn: arduino:avr:uno 51 | sketch-paths: | 52 | - 'examples/SimpleOneButton' 53 | - 'examples/TwoButtons' 54 | - 'examples/BlinkMachine' 55 | - 'examples/InterruptOneButton' 56 | - 'examples/SpecialInput' 57 | 58 | -------------------------------------------------------------------------------- /lib/OneButton/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea/ 3 | .vscode 4 | _* -------------------------------------------------------------------------------- /lib/OneButton/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file starting 2021. 4 | 5 | ## [2.0.1] - 2021-01-31 6 | 7 | * Compiler warning removed 8 | * Documentation 9 | 10 | ## [2.0.0] - 2021-01-22 11 | 12 | * CHANGELOG created. 13 | * Many thanks to the improvements included from #27 (**@aslobodyanuk**), #59 (**@ShaggyDog18**) and #73 (**@geeksville**). 14 | 15 | This is a major update with breaking changes. 16 | 17 | The **states** are re-factored to support counting the clicks. 18 | 19 | By design only one of the events (click, doubleClick, MultiClick) are triggered within one interaction. 20 | As a consequence a single-click interaction is detected after waiting some milliseconds (see setClickTicks()) without another click happening; 21 | Only if you have not attached any double-click event function the waiting time can be skipped. 22 | 23 | Detecting a long 'down' not only works with the first but always as the last click. 24 | 25 | The number of actual clicks can be retrieved from the library any time. 26 | 27 | The function **getPressedTicks()** was removed. See example SimpleOneButton on how to get that time by using attachLongPressStart to save starting time. 28 | 29 | The function **attachPressStart()** is removed as **attachLongPressStart()** does the same but also supports parameters. 30 | 31 | One additional feature has been added not to call the event functions from the interrupt routine and detect 32 | the need for event functions to be called only when the tick() function is called from the main loop() method. 33 | This is because some boards and processors do not support timing or Serial functions (among others) from interrupt routines. 34 | 35 | The function **isIdle()** was added to allow detect a current interaction. 36 | 37 | The library now supports to detect multiple (>2) clicks in a row using **attachMultiClick()** . 38 | 39 | 40 | * The internal _state is using enum instead of plain numbers to make the library more readable. 41 | * functions that had been marked deprecated are now removed. (attachPress->attachLongPressXXX) 42 | * added const to constant parameters to enable meaningful compiler warnings. 43 | * added code for de-bouncing double clicks from pull 27. 44 | * added isIdle() function to find out that the internal state is `init`. 45 | 46 | 47 | ### Examples 48 | 49 | * Examples run on NodeMCU boards. (the library worked already). 50 | 51 | * The **SimpleOneButton.ino** example got some cleanup and definition to be used with ESP8266 boards as well. 52 | 53 | * The **InterruptOneButton.ino** example now is using attachInterrupt instead of UNO specific register modifications. 54 | 55 | * The **SpecialInput.ino** example was added to shpow how to use the OneButton algorythm and input pattern recognition with your own source of input. 56 | -------------------------------------------------------------------------------- /lib/OneButton/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/lib/OneButton/LICENSE -------------------------------------------------------------------------------- /lib/OneButton/examples/BlinkMachine/BlinkMachine.ino: -------------------------------------------------------------------------------- 1 | /* 2 | BlinkMachine.ino 3 | 4 | This is a sample sketch to show how to use the OneButtonLibrary to detect double-click events on a button. 5 | 6 | Copyright (c) by Matthias Hertel, http://www.mathertel.de 7 | This work is licensed under a BSD style license. See http://www.mathertel.de/License.aspx 8 | More information on: http://www.mathertel.de/Arduino 9 | 10 | The library internals are explained at 11 | http://www.mathertel.de/Arduino/OneButtonLibrary.aspx 12 | 13 | Setup a test circuit: 14 | * Connect a pushbutton to pin A1 (Uno) or D3 (ESP8266) and ground. 15 | * The pin 13 (UNO) or D4 (ESP8266) is used for output attach a led and resistor to ground 16 | or see the built-in led on the standard arduino board. 17 | 18 | The Sketch shows how to setup the library and bind a "machine" that can blink the LED slow or fast. 19 | A click on the button turns the led on. 20 | A doubleclick on the button changes the blink rate from ON to SLOW to FAST and back. 21 | In the loop function the button.tick function has to be called as often as you like. 22 | 23 | State-Diagram 24 | 25 | start 26 | | +-------\ 27 | V V | 28 | -------- ------ | 29 | | OFF |<--click-+->| ON | | 30 | -------- | ------ | 31 | | | | 32 | | d-click | 33 | | | | 34 | | V | 35 | | ------ | 36 | +- | SLOW | | 37 | | ------ | 38 | | | | 39 | | d-click | 40 | | | | 41 | | V d-click 42 | | ------ | 43 | +--| FAST |---/ 44 | ------ 45 | */ 46 | 47 | // 06.10.2012 created by Matthias Hertel 48 | // 26.03.2017 state diagram added, minor changes 49 | 50 | #include "OneButton.h" 51 | 52 | // The actions I ca do... 53 | typedef enum { 54 | ACTION_OFF, // set LED "OFF". 55 | ACTION_ON, // set LED "ON" 56 | ACTION_SLOW, // blink LED "SLOW" 57 | ACTION_FAST // blink LED "FAST" 58 | } 59 | MyActions; 60 | 61 | #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO_EVERY) 62 | // Example for Arduino UNO with input button on pin 2 and builtin LED on pin 13 63 | #define PIN_INPUT A1 64 | #define PIN_LED 13 65 | 66 | #elif defined(ESP8266) 67 | // Example for NodeMCU with input button using FLASH button on D3 and using the led on -12 module (D4). 68 | // This LED is lighting on output level LOW. 69 | #define PIN_INPUT D3 70 | #define PIN_LED D4 71 | 72 | #endif 73 | 74 | // Setup a new OneButton on pin A1. 75 | OneButton button(PIN_INPUT, true); 76 | 77 | MyActions nextAction = ACTION_OFF; // no action when starting 78 | 79 | 80 | // setup code here, to run once. 81 | void setup() { 82 | // enable the standard led on pin 13. 83 | pinMode(PIN_LED, OUTPUT); // sets the digital pin as output 84 | 85 | // link the myClickFunction function to be called on a click event. 86 | button.attachClick(myClickFunction); 87 | 88 | // link the doubleclick function to be called on a doubleclick event. 89 | button.attachDoubleClick(myDoubleClickFunction); 90 | 91 | // set 80 msec. debouncing time. Default is 50 msec. 92 | button.setDebounceTicks(80); 93 | } // setup 94 | 95 | 96 | // main code here, to run repeatedly: 97 | void loop() { 98 | unsigned long now = millis(); 99 | 100 | // keep watching the push button: 101 | button.tick(); 102 | 103 | // You can implement other code in here or just wait a while 104 | 105 | if (nextAction == ACTION_OFF) { 106 | // do nothing. 107 | digitalWrite(PIN_LED, LOW); 108 | 109 | } else if (nextAction == ACTION_ON) { 110 | // turn LED on 111 | digitalWrite(PIN_LED, HIGH); 112 | 113 | } else if (nextAction == ACTION_SLOW) { 114 | // do a slow blinking 115 | if (now % 1000 < 500) { 116 | digitalWrite(PIN_LED, LOW); 117 | } else { 118 | digitalWrite(PIN_LED, HIGH); 119 | } // if 120 | 121 | } else if (nextAction == ACTION_FAST) { 122 | // do a fast blinking 123 | if (now % 200 < 100) { 124 | digitalWrite(PIN_LED, LOW); 125 | } else { 126 | digitalWrite(PIN_LED, HIGH); 127 | } // if 128 | } // if 129 | } // loop 130 | 131 | 132 | // this function will be called when the button was pressed 1 time and them some time has passed. 133 | void myClickFunction() { 134 | if (nextAction == ACTION_OFF) 135 | nextAction = ACTION_ON; 136 | else 137 | nextAction = ACTION_OFF; 138 | } // myClickFunction 139 | 140 | 141 | // this function will be called when the button was pressed 2 times in a short timeframe. 142 | void myDoubleClickFunction() { 143 | if (nextAction == ACTION_ON) { 144 | nextAction = ACTION_SLOW; 145 | 146 | } else if (nextAction == ACTION_SLOW) { 147 | nextAction = ACTION_FAST; 148 | 149 | } else if (nextAction == ACTION_FAST) { 150 | nextAction = ACTION_ON; 151 | } // if 152 | } // myDoubleClickFunction 153 | 154 | // End 155 | 156 | -------------------------------------------------------------------------------- /lib/OneButton/examples/SimpleOneButton/SimpleOneButton.ino: -------------------------------------------------------------------------------- 1 | /* 2 | This is a sample sketch to show how to use the OneButtonLibrary 3 | to detect double-click events on a button. 4 | The library internals are explained at 5 | http://www.mathertel.de/Arduino/OneButtonLibrary.aspx 6 | 7 | Setup a test circuit: 8 | * Connect a pushbutton to pin A1 (ButtonPin) and ground. 9 | * The pin 13 (StatusPin) is used for output attach a led and resistor to ground 10 | or see the built-in led on the standard arduino board. 11 | 12 | The sketch shows how to setup the library and bind the functions (singleClick, doubleClick) to the events. 13 | In the loop function the button.tick function must be called as often as you like. 14 | */ 15 | 16 | // 03.03.2011 created by Matthias Hertel 17 | // 01.12.2011 extension changed to work with the Arduino 1.0 environment 18 | 19 | #include "OneButton.h" 20 | 21 | #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO_EVERY) 22 | // Example for Arduino UNO with input button on pin 2 and builtin LED on pin 13 23 | #define PIN_INPUT 2 24 | #define PIN_LED 13 25 | 26 | #else if defined(ESP8266) 27 | // Example for NodeMCU with input button using FLASH button on D3 and using the led on -12 module (D4). 28 | // This LED is lighting on output level LOW. 29 | #define PIN_INPUT D3 30 | #define PIN_LED D4 31 | 32 | #endif 33 | 34 | // Setup a new OneButton on pin PIN_INPUT 35 | // The 2. parameter activeLOW is true, because external wiring sets the button to LOW when pressed. 36 | OneButton button(PIN_INPUT, true); 37 | 38 | // In case the momentary button puts the input to HIGH when pressed: 39 | // The 2. parameter activeLOW is false when the external wiring sets the button to HIGH when pressed. 40 | // The 3. parameter can be used to disable the PullUp . 41 | // OneButton button(PIN_INPUT, false, false); 42 | 43 | // current LED state, staring with LOW (0) 44 | int ledState = LOW; 45 | 46 | // setup code here, to run once: 47 | void setup() 48 | { 49 | Serial.begin(115200); 50 | Serial.println("One Button Example with polling."); 51 | 52 | // enable the standard led on pin 13. 53 | pinMode(PIN_LED, OUTPUT); // sets the digital pin as output 54 | 55 | // enable the standard led on pin 13. 56 | digitalWrite(PIN_LED, ledState); 57 | 58 | // link the doubleclick function to be called on a doubleclick event. 59 | button.attachDoubleClick(doubleClick); 60 | } // setup 61 | 62 | 63 | // main code here, to run repeatedly: 64 | void loop() 65 | { 66 | // keep watching the push button: 67 | button.tick(); 68 | 69 | // You can implement other code in here or just wait a while 70 | delay(10); 71 | } // loop 72 | 73 | 74 | // this function will be called when the button was pressed 2 times in a short timeframe. 75 | void doubleClick() 76 | { 77 | Serial.println("x2"); 78 | 79 | ledState = !ledState; // reverse the LED 80 | digitalWrite(PIN_LED, ledState); 81 | } // doubleClick 82 | 83 | // End -------------------------------------------------------------------------------- /lib/OneButton/examples/SpecialInput/SpecialInput.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * SpecialInput.ino - Example for the OneButtonLibrary library. 3 | * This is a sample sketch to show how to use the OneClick library on other input sources than standard digital pins. 4 | * 5 | * The library internals are explained at 6 | * http://www.mathertel.de/Arduino/OneButtonLibrary.aspx 7 | * 8 | * Setup a test circuit: 9 | * * Connect a pushbutton to pin 2 (ButtonPin) and ground. 10 | * 11 | * The sketch shows how to setup the library and bind the functions (singleClick, doubleClick) to the events. 12 | * In the loop function the button.tick function must be called as often as you like. 13 | * 14 | * * 22.01.2021 created by Matthias Hertel 15 | */ 16 | 17 | #include "OneButton.h" 18 | 19 | // This is an example on how to use the OneClick library on other input sources than standard digital pins. 20 | // 1. do not use a pin in the initialization of the OneClick library. 21 | // 2. pass the input state to the tick function. 22 | 23 | // You can also find how to create an instance in setup and not by declaration. 24 | // You can also find how to use inline callback functions. 25 | 26 | #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO_EVERY) 27 | #define PIN_INPUT 2 28 | 29 | #else if defined(ESP8266) 30 | #define PIN_INPUT D3 31 | 32 | #endif 33 | 34 | 35 | // OneButton instance will be created in setup. 36 | OneButton *button; 37 | 38 | void fClicked(void *s) 39 | { 40 | Serial.print("Click:"); 41 | Serial.println((char *)s); 42 | } 43 | 44 | void setup() 45 | { 46 | Serial.begin(115200); 47 | Serial.println("One Button Example with custom input."); 48 | 49 | // create the OneButton instance without a pin. 50 | button = new OneButton(); 51 | 52 | // Here is an example on how to use a parameter to the registered function: 53 | button->attachClick(fClicked, "me"); 54 | 55 | // Here is an example on how to use an inline function: 56 | button->attachDoubleClick([]() { Serial.println("DoubleClick"); }); 57 | 58 | // setup your own source of input: 59 | pinMode(PIN_INPUT, INPUT_PULLUP); 60 | 61 | } // setup() 62 | 63 | void loop() 64 | { 65 | // read your own source of input: 66 | bool isPressed = (digitalRead(PIN_INPUT) == LOW); 67 | 68 | // call tick frequently with current push-state of the input 69 | button->tick(isPressed); 70 | } // loop() 71 | -------------------------------------------------------------------------------- /lib/OneButton/examples/TwoButtons/TwoButtons.ino: -------------------------------------------------------------------------------- 1 | /* 2 | This is a sample sketch to show how to use the OneButtonLibrary 3 | to detect click events on 2 buttons in parallel. 4 | The library internals are explained at 5 | http://www.mathertel.de/Arduino/OneButtonLibrary.aspx 6 | 7 | Setup a test circuit: 8 | * Connect a pushbutton to pin A1 (ButtonPin) and ground. 9 | * Connect a pushbutton to pin A2 (ButtonPin) and ground. 10 | * The Serial interface is used for output the detected button events. 11 | 12 | The Sketch shows how to setup the library and bind 2 buttons to their functions. 13 | In the loop function the button1.tick and button2.tick functions have to be called as often as you like. 14 | */ 15 | 16 | // 01.03.2014 created by Matthias Hertel 17 | // ... and working. 18 | 19 | /* Sample output: 20 | 21 | Starting TwoButtons... 22 | Button 1 click. 23 | Button 2 click. 24 | Button 1 doubleclick. 25 | Button 2 doubleclick. 26 | Button 1 longPress start 27 | Button 1 longPress... 28 | Button 1 longPress... 29 | Button 1 longPress... 30 | Button 1 longPress stop 31 | Button 2 longPress start 32 | Button 2 longPress... 33 | Button 2 longPress... 34 | Button 2 longPress stop 35 | 36 | */ 37 | 38 | #include "OneButton.h" 39 | 40 | // Setup a new OneButton on pin A1. 41 | OneButton button1(A1, true); 42 | // Setup a new OneButton on pin A2. 43 | OneButton button2(A2, true); 44 | 45 | 46 | // setup code here, to run once: 47 | void setup() { 48 | // Setup the Serial port. see http://arduino.cc/en/Serial/IfSerial 49 | Serial.begin(115200); 50 | while (!Serial) { 51 | ; // wait for serial port to connect. Needed for Leonardo only 52 | } 53 | Serial.println("Starting TwoButtons..."); 54 | 55 | // link the button 1 functions. 56 | button1.attachClick(click1); 57 | button1.attachDoubleClick(doubleclick1); 58 | button1.attachLongPressStart(longPressStart1); 59 | button1.attachLongPressStop(longPressStop1); 60 | button1.attachDuringLongPress(longPress1); 61 | 62 | // link the button 2 functions. 63 | button2.attachClick(click2); 64 | button2.attachDoubleClick(doubleclick2); 65 | button2.attachLongPressStart(longPressStart2); 66 | button2.attachLongPressStop(longPressStop2); 67 | button2.attachDuringLongPress(longPress2); 68 | 69 | } // setup 70 | 71 | 72 | // main code here, to run repeatedly: 73 | void loop() { 74 | // keep watching the push buttons: 75 | button1.tick(); 76 | button2.tick(); 77 | 78 | // You can implement other code in here or just wait a while 79 | delay(10); 80 | } // loop 81 | 82 | 83 | // ----- button 1 callback functions 84 | 85 | // This function will be called when the button1 was pressed 1 time (and no 2. button press followed). 86 | void click1() { 87 | Serial.println("Button 1 click."); 88 | } // click1 89 | 90 | 91 | // This function will be called when the button1 was pressed 2 times in a short timeframe. 92 | void doubleclick1() { 93 | Serial.println("Button 1 doubleclick."); 94 | } // doubleclick1 95 | 96 | 97 | // This function will be called once, when the button1 is pressed for a long time. 98 | void longPressStart1() { 99 | Serial.println("Button 1 longPress start"); 100 | } // longPressStart1 101 | 102 | 103 | // This function will be called often, while the button1 is pressed for a long time. 104 | void longPress1() { 105 | Serial.println("Button 1 longPress..."); 106 | } // longPress1 107 | 108 | 109 | // This function will be called once, when the button1 is released after beeing pressed for a long time. 110 | void longPressStop1() { 111 | Serial.println("Button 1 longPress stop"); 112 | } // longPressStop1 113 | 114 | 115 | // ... and the same for button 2: 116 | 117 | void click2() { 118 | Serial.println("Button 2 click."); 119 | } // click2 120 | 121 | 122 | void doubleclick2() { 123 | Serial.println("Button 2 doubleclick."); 124 | } // doubleclick2 125 | 126 | 127 | void longPressStart2() { 128 | Serial.println("Button 2 longPress start"); 129 | } // longPressStart2 130 | 131 | 132 | void longPress2() { 133 | Serial.println("Button 2 longPress..."); 134 | } // longPress2 135 | 136 | void longPressStop2() { 137 | Serial.println("Button 2 longPress stop"); 138 | } // longPressStop2 139 | 140 | 141 | // End 142 | 143 | -------------------------------------------------------------------------------- /lib/OneButton/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for OneButton 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | callbackFunction KEYWORD1 10 | parameterizedCallbackFunction KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | setClickTicks KEYWORD2 17 | setPressTicks KEYWORD2 18 | setDebounceTicks KEYWORD2 19 | attachClick KEYWORD2 20 | attachDoubleClick KEYWORD2 21 | attachMultiClick KEYWORD2 22 | attachLongPressStart KEYWORD2 23 | attachLongPressStop KEYWORD2 24 | attachDuringLongPress KEYWORD2 25 | tick KEYWORD2 26 | reset KEYWORD2 27 | getNumberClicks KEYWORD2 28 | isIdle KEYWORD2 29 | isLongPressed KEYWORD2 30 | 31 | ####################################### 32 | # Instances (KEYWORD2) 33 | ####################################### 34 | 35 | OneButton KEYWORD2 36 | 37 | ####################################### 38 | # Constants (LITERAL1) 39 | ####################################### 40 | 41 | 42 | -------------------------------------------------------------------------------- /lib/OneButton/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OneButton", 3 | "version": "2.0.2", 4 | "keywords": "arduino, button, pushbutton", 5 | "description": "This Arduino library is improving the usage of a singe button for input. It shows how to use an digital input pin with a single pushbutton attached for detecting some of the typical button press events like single clicks, double clicks and long-time pressing. This enables you to reuse the same button for multiple functions and lowers the hardware invests.", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/mathertel/OneButton" 9 | }, 10 | "authors": { 11 | "name": "Matthias Hertel", 12 | "email": "mathertel@hotmail.com", 13 | "url": "https://www.mathertel.de/impressum.aspx" 14 | }, 15 | "license": "BSD-3-Clause", 16 | "homepage": "http://www.mathertel.de/Arduino/OneButtonLibrary.aspx", 17 | "frameworks": "arduino", 18 | "platforms": "*" 19 | } -------------------------------------------------------------------------------- /lib/OneButton/library.properties: -------------------------------------------------------------------------------- 1 | name=OneButton 2 | version=2.0.2 3 | author=Matthias Hertel, mathertel@hotmail.com 4 | maintainer=Matthias Hertel 5 | sentence=Arduino library for improving the usage of a singe input button. 6 | paragraph=It supports detecting events like single, double, multiple clicks and long-time pressing. This enables you to reuse the same button for multiple functions and lowers the hardware invests. 7 | category=Signal Input/Output 8 | url=https://github.com/mathertel/OneButton 9 | architectures=* 10 | includes=OneButton.h 11 | license=BSD-3-Clause 12 | -------------------------------------------------------------------------------- /lib/PID/PID_v1.h: -------------------------------------------------------------------------------- 1 | #ifndef PID_v1_h 2 | #define PID_v1_h 3 | #define LIBRARY_VERSION 1.2.1 4 | 5 | class PID 6 | { 7 | 8 | 9 | public: 10 | 11 | //Constants used in some of the functions below 12 | #define AUTOMATIC 1 13 | #define MANUAL 0 14 | #define DIRECT 0 15 | #define REVERSE 1 16 | #define P_ON_M 0 17 | #define P_ON_E 1 18 | 19 | //commonly used functions ************************************************************************** 20 | PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and 21 | double, double, double, int, int);// Setpoint. Initial tuning parameters are also set here. 22 | // (overload for specifying proportional mode) 23 | 24 | PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and 25 | double, double, double, int); // Setpoint. Initial tuning parameters are also set here 26 | 27 | void SetMode(int Mode); // * sets PID to either Manual (0) or Auto (non-0) 28 | 29 | bool Compute(); // * performs the PID calculation. it should be 30 | // called every time loop() cycles. ON/OFF and 31 | // calculation frequency can be set using SetMode 32 | // SetSampleTime respectively 33 | 34 | void SetOutputLimits(double, double); // * clamps the output to a specific range. 0-255 by default, but 35 | // it's likely the user will want to change this depending on 36 | // the application 37 | 38 | 39 | 40 | //available but not commonly used functions ******************************************************** 41 | void SetTunings(double, double, // * While most users will set the tunings once in the 42 | double); // constructor, this function gives the user the option 43 | // of changing tunings during runtime for Adaptive control 44 | void SetTunings(double, double, // * overload for specifying proportional mode 45 | double, int); 46 | 47 | void SetControllerDirection(int); // * Sets the Direction, or "Action" of the controller. DIRECT 48 | // means the output will increase when error is positive. REVERSE 49 | // means the opposite. it's very unlikely that this will be needed 50 | // once it is set in the constructor. 51 | void SetSampleTime(int); // * sets the frequency, in Milliseconds, with which 52 | // the PID calculation is performed. default is 100 53 | 54 | 55 | 56 | //Display functions **************************************************************** 57 | double GetKp(); // These functions query the pid for interal values. 58 | double GetKi(); // they were created mainly for the pid front-end, 59 | double GetKd(); // where it's important to know what is actually 60 | int GetMode(); // inside the PID. 61 | int GetDirection(); // 62 | 63 | private: 64 | void Initialize(); 65 | 66 | double dispKp; // * we'll hold on to the tuning parameters in user-entered 67 | double dispKi; // format for display purposes 68 | double dispKd; // 69 | 70 | double kp; // * (P)roportional Tuning Parameter 71 | double ki; // * (I)ntegral Tuning Parameter 72 | double kd; // * (D)erivative Tuning Parameter 73 | 74 | int controllerDirection; 75 | int pOn; 76 | 77 | double *myInput; // * Pointers to the Input, Output, and Setpoint variables 78 | double *myOutput; // This creates a hard link between the variables and the 79 | double *mySetpoint; // PID, freeing the user from having to constantly tell us 80 | // what these values are. with pointers we'll just know. 81 | 82 | unsigned long lastTime; 83 | double outputSum, lastInput; 84 | 85 | unsigned long SampleTime; 86 | double outMin, outMax; 87 | bool inAuto, pOnE; 88 | }; 89 | #endif 90 | 91 | -------------------------------------------------------------------------------- /lib/PID/README.txt: -------------------------------------------------------------------------------- 1 | *************************************************************** 2 | * Arduino PID Library - Version 1.2.1 3 | * by Brett Beauregard brettbeauregard.com 4 | * 5 | * This Library is licensed under the MIT License 6 | *************************************************************** 7 | 8 | - For an ultra-detailed explanation of why the code is the way it is, please visit: 9 | http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/ 10 | 11 | - For function documentation see: http://playground.arduino.cc/Code/PIDLibrary 12 | -------------------------------------------------------------------------------- /lib/PID/examples/PID_AdaptiveTunings/PID_AdaptiveTunings.ino: -------------------------------------------------------------------------------- 1 | /******************************************************** 2 | * PID Adaptive Tuning Example 3 | * One of the benefits of the PID library is that you can 4 | * change the tuning parameters at any time. this can be 5 | * helpful if we want the controller to be agressive at some 6 | * times, and conservative at others. in the example below 7 | * we set the controller to use Conservative Tuning Parameters 8 | * when we're near setpoint and more agressive Tuning 9 | * Parameters when we're farther away. 10 | ********************************************************/ 11 | 12 | #include 13 | 14 | #define PIN_INPUT 0 15 | #define PIN_OUTPUT 3 16 | 17 | //Define Variables we'll be connecting to 18 | double Setpoint, Input, Output; 19 | 20 | //Define the aggressive and conservative Tuning Parameters 21 | double aggKp=4, aggKi=0.2, aggKd=1; 22 | double consKp=1, consKi=0.05, consKd=0.25; 23 | 24 | //Specify the links and initial tuning parameters 25 | PID myPID(&Input, &Output, &Setpoint, consKp, consKi, consKd, DIRECT); 26 | 27 | void setup() 28 | { 29 | //initialize the variables we're linked to 30 | Input = analogRead(PIN_INPUT); 31 | Setpoint = 100; 32 | 33 | //turn the PID on 34 | myPID.SetMode(AUTOMATIC); 35 | } 36 | 37 | void loop() 38 | { 39 | Input = analogRead(PIN_INPUT); 40 | 41 | double gap = abs(Setpoint-Input); //distance away from setpoint 42 | if (gap < 10) 43 | { //we're close to setpoint, use conservative tuning parameters 44 | myPID.SetTunings(consKp, consKi, consKd); 45 | } 46 | else 47 | { 48 | //we're far from setpoint, use aggressive tuning parameters 49 | myPID.SetTunings(aggKp, aggKi, aggKd); 50 | } 51 | 52 | myPID.Compute(); 53 | analogWrite(PIN_OUTPUT, Output); 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /lib/PID/examples/PID_Basic/PID_Basic.ino: -------------------------------------------------------------------------------- 1 | /******************************************************** 2 | * PID Basic Example 3 | * Reading analog input 0 to control analog PWM output 3 4 | ********************************************************/ 5 | 6 | #include 7 | 8 | #define PIN_INPUT 0 9 | #define PIN_OUTPUT 3 10 | 11 | //Define Variables we'll be connecting to 12 | double Setpoint, Input, Output; 13 | 14 | //Specify the links and initial tuning parameters 15 | double Kp=2, Ki=5, Kd=1; 16 | PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT); 17 | 18 | void setup() 19 | { 20 | //initialize the variables we're linked to 21 | Input = analogRead(PIN_INPUT); 22 | Setpoint = 100; 23 | 24 | //turn the PID on 25 | myPID.SetMode(AUTOMATIC); 26 | } 27 | 28 | void loop() 29 | { 30 | Input = analogRead(PIN_INPUT); 31 | myPID.Compute(); 32 | analogWrite(PIN_OUTPUT, Output); 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /lib/PID/examples/PID_PonM/PID_PonM.ino: -------------------------------------------------------------------------------- 1 | /******************************************************** 2 | * PID Proportional on measurement Example 3 | * Setting the PID to use Proportional on measurement will 4 | * make the output move more smoothly when the setpoint 5 | * is changed. In addition, it can eliminate overshoot 6 | * in certain processes like sous-vides. 7 | ********************************************************/ 8 | 9 | #include 10 | 11 | //Define Variables we'll be connecting to 12 | double Setpoint, Input, Output; 13 | 14 | //Specify the links and initial tuning parameters 15 | PID myPID(&Input, &Output, &Setpoint,2,5,1,P_ON_M, DIRECT); //P_ON_M specifies that Proportional on Measurement be used 16 | //P_ON_E (Proportional on Error) is the default behavior 17 | 18 | void setup() 19 | { 20 | //initialize the variables we're linked to 21 | Input = analogRead(0); 22 | Setpoint = 100; 23 | 24 | //turn the PID on 25 | myPID.SetMode(AUTOMATIC); 26 | } 27 | 28 | void loop() 29 | { 30 | Input = analogRead(0); 31 | myPID.Compute(); 32 | analogWrite(3,Output); 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /lib/PID/examples/PID_RelayOutput/PID_RelayOutput.ino: -------------------------------------------------------------------------------- 1 | /******************************************************** 2 | * PID RelayOutput Example 3 | * Same as basic example, except that this time, the output 4 | * is going to a digital pin which (we presume) is controlling 5 | * a relay. the pid is designed to Output an analog value, 6 | * but the relay can only be On/Off. 7 | * 8 | * to connect them together we use "time proportioning 9 | * control" it's essentially a really slow version of PWM. 10 | * first we decide on a window size (5000mS say.) we then 11 | * set the pid to adjust its output between 0 and that window 12 | * size. lastly, we add some logic that translates the PID 13 | * output into "Relay On Time" with the remainder of the 14 | * window being "Relay Off Time" 15 | ********************************************************/ 16 | 17 | #include 18 | 19 | #define PIN_INPUT 0 20 | #define RELAY_PIN 6 21 | 22 | //Define Variables we'll be connecting to 23 | double Setpoint, Input, Output; 24 | 25 | //Specify the links and initial tuning parameters 26 | double Kp=2, Ki=5, Kd=1; 27 | PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT); 28 | 29 | int WindowSize = 5000; 30 | unsigned long windowStartTime; 31 | 32 | void setup() 33 | { 34 | windowStartTime = millis(); 35 | 36 | //initialize the variables we're linked to 37 | Setpoint = 100; 38 | 39 | //tell the PID to range between 0 and the full window size 40 | myPID.SetOutputLimits(0, WindowSize); 41 | 42 | //turn the PID on 43 | myPID.SetMode(AUTOMATIC); 44 | } 45 | 46 | void loop() 47 | { 48 | Input = analogRead(PIN_INPUT); 49 | myPID.Compute(); 50 | 51 | /************************************************ 52 | * turn the output pin on/off based on pid output 53 | ************************************************/ 54 | if (millis() - windowStartTime > WindowSize) 55 | { //time to shift the Relay Window 56 | windowStartTime += WindowSize; 57 | } 58 | if (Output < millis() - windowStartTime) digitalWrite(RELAY_PIN, HIGH); 59 | else digitalWrite(RELAY_PIN, LOW); 60 | 61 | } 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /lib/PID/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For PID Library 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | PID KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | SetMode KEYWORD2 16 | Compute KEYWORD2 17 | SetOutputLimits KEYWORD2 18 | SetTunings KEYWORD2 19 | SetControllerDirection KEYWORD2 20 | SetSampleTime KEYWORD2 21 | GetKp KEYWORD2 22 | GetKi KEYWORD2 23 | GetKd KEYWORD2 24 | GetMode KEYWORD2 25 | GetDirection KEYWORD2 26 | 27 | ####################################### 28 | # Constants (LITERAL1) 29 | ####################################### 30 | 31 | AUTOMATIC LITERAL1 32 | MANUAL LITERAL1 33 | DIRECT LITERAL1 34 | REVERSE LITERAL1 35 | P_ON_E LITERAL1 36 | P_ON_M LITERAL1 37 | -------------------------------------------------------------------------------- /lib/PID/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PID", 3 | "keywords": "PID, controller, signal", 4 | "description": "A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).", 5 | "url": "http://playground.arduino.cc/Code/PIDLibrary", 6 | "include": "PID_v1", 7 | "authors": 8 | [ 9 | { 10 | "name": "Brett Beauregard" 11 | } 12 | ], 13 | "repository": 14 | { 15 | "type": "git", 16 | "url": "https://github.com/br3ttb/Arduino-PID-Library.git" 17 | }, 18 | "frameworks": "arduino" 19 | } 20 | -------------------------------------------------------------------------------- /lib/PID/library.properties: -------------------------------------------------------------------------------- 1 | name=PID 2 | version=1.2.1 3 | author=Brett Beauregard 4 | maintainer=Brett Beauregard 5 | sentence=PID controller 6 | paragraph=A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D). 7 | category=Signal Input/Output 8 | url=http://playground.arduino.cc/Code/PIDLibrary 9 | architectures=* 10 | -------------------------------------------------------------------------------- /lib/QRCode/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /lib/QRCode/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | This library is written and maintained by Richard Moore. 4 | Major parts were derived from Project Nayuki's library. 5 | 6 | Copyright (c) 2017 Richard Moore (https://github.com/ricmoo/QRCode) 7 | Copyright (c) 2017 Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library) 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | 27 | -------------------------------------------------------------------------------- /lib/QRCode/examples/QRCode/QRCode.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * QRCode 3 | * 4 | * A quick example of generating a QR code. 5 | * 6 | * This prints the QR code to the serial monitor as solid blocks. Each module 7 | * is two characters wide, since the monospace font used in the serial monitor 8 | * is approximately twice as tall as wide. 9 | * 10 | */ 11 | 12 | #include "qrcode.h" 13 | 14 | void setup() { 15 | Serial.begin(115200); 16 | 17 | // Start time 18 | uint32_t dt = millis(); 19 | 20 | // Create the QR code 21 | QRCode qrcode; 22 | uint8_t qrcodeData[qrcode_getBufferSize(3)]; 23 | qrcode_initText(&qrcode, qrcodeData, 3, 0, "HELLO WORLD"); 24 | 25 | // Delta time 26 | dt = millis() - dt; 27 | Serial.print("QR Code Generation Time: "); 28 | Serial.print(dt); 29 | Serial.print("\n"); 30 | 31 | // Top quiet zone 32 | Serial.print("\n\n\n\n"); 33 | 34 | for (uint8_t y = 0; y < qrcode.size; y++) { 35 | 36 | // Left quiet zone 37 | Serial.print(" "); 38 | 39 | // Each horizontal module 40 | for (uint8_t x = 0; x < qrcode.size; x++) { 41 | 42 | // Print each module (UTF-8 \u2588 is a solid block) 43 | Serial.print(qrcode_getModule(&qrcode, x, y) ? "\u2588\u2588": " "); 44 | 45 | } 46 | 47 | Serial.print("\n"); 48 | } 49 | 50 | // Bottom quiet zone 51 | Serial.print("\n\n\n\n"); 52 | } 53 | 54 | void loop() { 55 | 56 | } 57 | -------------------------------------------------------------------------------- /lib/QRCode/generate_table.py: -------------------------------------------------------------------------------- 1 | Data = [ 2 | ["1", "41", "25", "17", "34", "20", "14","27", "16", "11","17", "10", "7"], 3 | ["2", "77", "47", "32", "63", "38", "26", "48", "29", "20", "34", "20", "14"], 4 | ["3", "127", "77", "53", "101", "61", "42", "77", "47", "32", "58", "35", "24"], 5 | ["4", "187", "114", "78", "149", "90", "62", "111", "67", "46", "82", "50", "34"], 6 | ["5", "255", "154", "106", "202", "122", "84", "144", "87", "60", "106", "64", "44"], 7 | ["6", "322", "195", "134", "255", "154", "106", "178", "108", "74", "139", "84", "58"], 8 | ["7", "370", "224", "154", "293", "178", "122", "207", "125", "86", "154", "93", "64"], 9 | ["8", "461", "279", "192", "365", "221", "152", "259", "157", "108", "202", "122", "84"], 10 | ["9", "552", "335", "230", "432", "262", "180", "312", "189", "130", "235", "143", "98"], 11 | ["10", "652", "395", "271", "513", "311", "213", "364", "221", "151", "288", "174", "119"], 12 | ["11", "772", "468", "321", "604", "366", "251", "427", "259", "177", "331", "200", "137"], 13 | ["12", "883", "535", "367", "691", "419", "287", "489", "296", "203", "374", "227", "155"], 14 | ["13", "1022", "619", "425", "796", "483", "331", "580", "352", "241", "427", "259", "177"], 15 | ["14", "1101", "667", "458", "871", "528", "362", "621", "376", "258", "468", "283", "194"], 16 | ["15", "1250", "758", "520", "991", "600", "412", "703", "426", "292", "530", "321", "220"], 17 | ["16", "1408", "854", "586", "1082", "656", "450", "775", "470", "322", "602", "365", "250"], 18 | ["17", "1548", "938", "644", "1212", "734", "504", "876", "531", "364", "674", "408", "280"], 19 | ["18", "1725", "1046", "718", "1346", "816", "560", "948", "574", "394", "746", "452", "310"], 20 | ["19", "1903", "1153", "792", "1500", "909", "624", "1063", "644", "442", "813", "493", "338"], 21 | ["20", "2061", "1249", "858", "1600", "970", "666", "1159", "702", "482", "919", "557", "382"], 22 | ["21", "2232", "1352", "929", "1708", "1035", "711", "1224", "742", "509", "969", "587", "403"], 23 | ["22", "2409", "1460", "1003", "1872", "1134", "779", "1358", "823", "565", "1056", "640", "439"], 24 | ["23", "2620", "1588", "1091", "2059", "1248", "857", "1468", "890", "611", "1108", "672", "461"], 25 | ["24", "2812", "1704", "1171", "2188", "1326", "911", "1588", "963", "661", "1228", "744", "511"], 26 | ["25", "3057", "1853", "1273", "2395", "1451", "997", "1718", "1041", "715", "1286", "779", "535"], 27 | ["26", "3283", "1990", "1367", "2544", "1542", "1059", "1804", "1094", "751", "1425", "864", "593"], 28 | ["27", "3517", "2132", "1465", "2701", "1637", "1125", "1933", "1172", "805", "1501", "910", "625"], 29 | ["28", "3669", "2223", "1528", "2857", "1732", "1190", "2085", "1263", "868", "1581", "958", "658"], 30 | ["29", "3909", "2369", "1628", "3035", "1839", "1264", "2181", "1322", "908", "1677", "1016", "698"], 31 | ["30", "4158", "2520", "1732", "3289", "1994", "1370", "2358", "1429", "982", "1782", "1080", "742"], 32 | ["31", "4417", "2677", "1840", "3486", "2113", "1452", "2473", "1499", "1030", "1897", "1150", "790"], 33 | ["32", "4686", "2840", "1952", "3693", "2238", "1538", "2670", "1618", "1112", "2022", "1226", "842"], 34 | ["33", "4965", "3009", "2068", "3909", "2369", "1628", "2805", "1700", "1168", "2157", "1307", "898"], 35 | ["34", "5253", "3183", "2188", "4134", "2506", "1722", "2949", "1787", "1228", "2301", "1394", "958"], 36 | ["35", "5529", "3351", "2303", "4343", "2632", "1809", "3081", "1867", "1283", "2361", "1431", "983"], 37 | ["36", "5836", "3537", "2431", "4588", "2780", "1911", "3244", "1966", "1351", "2524", "1530", "1051"], 38 | ["37", "6153", "3729", "2563", "4775", "2894", "1989", "3417", "2071", "1423", "2625", "1591", "1093"], 39 | ["38", "6479", "3927", "2699", "5039", "3054", "2099", "3599", "2181", "1499", "2735", "1658", "1139"], 40 | ["39", "6743", "4087", "2809", "5313", "3220", "2213", "3791", "2298", "1579", "2927", "1774", "1219"], 41 | ["40", "7089", "4296", "2953", "5596", "3391", "2331", "3993", "2420", "1663", "3057", "1852", "1273"], 42 | ] 43 | Template = ''' 44 | %s 45 | %s 46 | LOW%s%s%s 47 | 48 | 49 | MEDIUM%s%s%s 50 | 51 | 52 | QUARTILE%s%s%s 53 | 54 | 55 | HIGH%s%s%s 56 | ''' 57 | 58 | for data in Data: 59 | data = data[:] 60 | size = 4 * int(data[0]) + 17 61 | data.insert(1, "%d x %d" % (size, size)) 62 | print Template % tuple(data) 63 | -------------------------------------------------------------------------------- /lib/QRCode/keywords.txt: -------------------------------------------------------------------------------- 1 | 2 | # Datatypes (KEYWORD1) 3 | 4 | bool KEYWORD1 5 | uint8_t KEYWORD1 6 | QRCode KEYWORD1 7 | 8 | 9 | # Methods and Functions (KEYWORD2) 10 | 11 | qrcode_getBufferSize KEYWORD2 12 | qrcode_initText KEYWORD2 13 | qrcode_initBytes KEYWORD2 14 | qrcode_getModule KEYWORD2 15 | 16 | 17 | # Instances (KEYWORD2) 18 | 19 | 20 | # Constants (LITERAL1) 21 | 22 | false LITERAL1 23 | true LITERAL1 24 | 25 | ECC_LOW LITERAL1 26 | ECC_MEDIUM LITERAL1 27 | ECC_QUARTILE LITERAL1 28 | ECC_HIGH LITERAL1 29 | MODE_NUMERIC LITERAL1 30 | MODE_ALPHANUMERIC LITERAL1 31 | MODE_BYTE LITERAL1 32 | -------------------------------------------------------------------------------- /lib/QRCode/library.properties: -------------------------------------------------------------------------------- 1 | name=QRCode 2 | version=0.0.1 3 | author=Richard Moore 4 | maintainer=Richard Moore 5 | sentence=A simple QR code generation library. 6 | paragraph=A simple QR code generation library. 7 | category=Other 8 | url=https://github.com/ricmoo/qrcode/ 9 | architectures=* 10 | includes=qrcode.h 11 | -------------------------------------------------------------------------------- /lib/QRCode/src/qrcode.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * This library is written and maintained by Richard Moore. 5 | * Major parts were derived from Project Nayuki's library. 6 | * 7 | * Copyright (c) 2017 Richard Moore (https://github.com/ricmoo/QRCode) 8 | * Copyright (c) 2017 Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library) 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, and to permit persons to whom the Software is 15 | * furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included in 18 | * all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | * THE SOFTWARE. 27 | */ 28 | 29 | /** 30 | * Special thanks to Nayuki (https://www.nayuki.io/) from which this library was 31 | * heavily inspired and compared against. 32 | * 33 | * See: https://github.com/nayuki/QR-Code-generator/tree/master/cpp 34 | */ 35 | 36 | 37 | #ifndef __QRCODE_H_ 38 | #define __QRCODE_H_ 39 | 40 | #ifndef __cplusplus 41 | typedef unsigned char bool; 42 | static const bool false = 0; 43 | static const bool true = 1; 44 | #endif 45 | 46 | #include 47 | 48 | 49 | // QR Code Format Encoding 50 | #define MODE_NUMERIC 0 51 | #define MODE_ALPHANUMERIC 1 52 | #define MODE_BYTE 2 53 | 54 | 55 | // Error Correction Code Levels 56 | #define ECC_LOW 0 57 | #define ECC_MEDIUM 1 58 | #define ECC_QUARTILE 2 59 | #define ECC_HIGH 3 60 | 61 | 62 | // If set to non-zero, this library can ONLY produce QR codes at that version 63 | // This saves a lot of dynamic memory, as the codeword tables are skipped 64 | #ifndef LOCK_VERSION 65 | #define LOCK_VERSION 0 66 | #endif 67 | 68 | 69 | typedef struct QRCode { 70 | uint8_t version; 71 | uint8_t size; 72 | uint8_t ecc; 73 | uint8_t mode; 74 | uint8_t mask; 75 | uint8_t *modules; 76 | } QRCode; 77 | 78 | 79 | #ifdef __cplusplus 80 | extern "C"{ 81 | #endif /* __cplusplus */ 82 | 83 | 84 | 85 | uint16_t qrcode_getBufferSize(uint8_t version); 86 | 87 | int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data); 88 | int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length); 89 | 90 | bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y); 91 | 92 | 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif /* __cplusplus */ 97 | 98 | 99 | #endif /* __QRCODE_H_ */ 100 | -------------------------------------------------------------------------------- /lib/QRCode/tests/BitBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * QR Code generator library (C++) 3 | * 4 | * Copyright (c) Project Nayuki 5 | * https://www.nayuki.io/page/qr-code-generator-library 6 | * 7 | * (MIT License) 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * - The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * - The Software is provided "as is", without warranty of any kind, express or 17 | * implied, including but not limited to the warranties of merchantability, 18 | * fitness for a particular purpose and noninfringement. In no event shall the 19 | * authors or copyright holders be liable for any claim, damages or other 20 | * liability, whether in an action of contract, tort or otherwise, arising from, 21 | * out of or in connection with the Software or the use or other dealings in the 22 | * Software. 23 | */ 24 | 25 | #include 26 | #include "BitBuffer.hpp" 27 | 28 | 29 | qrcodegen::BitBuffer::BitBuffer() : 30 | data(), 31 | bitLength(0) {} 32 | 33 | 34 | int qrcodegen::BitBuffer::getBitLength() const { 35 | return bitLength; 36 | } 37 | 38 | 39 | std::vector qrcodegen::BitBuffer::getBytes() const { 40 | return data; 41 | } 42 | 43 | 44 | void qrcodegen::BitBuffer::appendBits(uint32_t val, int len) { 45 | if (len < 0 || len > 32 || (len < 32 && (val >> len) != 0)) 46 | throw "Value out of range"; 47 | size_t newBitLen = bitLength + len; 48 | while (data.size() * 8 < newBitLen) 49 | data.push_back(0); 50 | for (int i = len - 1; i >= 0; i--, bitLength++) // Append bit by bit 51 | data.at(bitLength >> 3) |= ((val >> i) & 1) << (7 - (bitLength & 7)); 52 | } 53 | 54 | 55 | void qrcodegen::BitBuffer::appendData(const QrSegment &seg) { 56 | size_t newBitLen = bitLength + seg.bitLength; 57 | while (data.size() * 8 < newBitLen) 58 | data.push_back(0); 59 | for (int i = 0; i < seg.bitLength; i++, bitLength++) { // Append bit by bit 60 | int bit = (seg.data.at(i >> 3) >> (7 - (i & 7))) & 1; 61 | data.at(bitLength >> 3) |= bit << (7 - (bitLength & 7)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/QRCode/tests/BitBuffer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * QR Code generator library (C++) 3 | * 4 | * Copyright (c) Project Nayuki 5 | * https://www.nayuki.io/page/qr-code-generator-library 6 | * 7 | * (MIT License) 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * - The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * - The Software is provided "as is", without warranty of any kind, express or 17 | * implied, including but not limited to the warranties of merchantability, 18 | * fitness for a particular purpose and noninfringement. In no event shall the 19 | * authors or copyright holders be liable for any claim, damages or other 20 | * liability, whether in an action of contract, tort or otherwise, arising from, 21 | * out of or in connection with the Software or the use or other dealings in the 22 | * Software. 23 | */ 24 | 25 | #pragma once 26 | 27 | #include 28 | #include 29 | #include "QrSegment.hpp" 30 | 31 | 32 | namespace qrcodegen { 33 | 34 | /* 35 | * An appendable sequence of bits. Bits are packed in big endian within a byte. 36 | */ 37 | class BitBuffer { 38 | 39 | /*---- Fields ----*/ 40 | private: 41 | 42 | std::vector data; 43 | int bitLength; 44 | 45 | 46 | 47 | /*---- Constructor ----*/ 48 | public: 49 | 50 | // Creates an empty bit buffer (length 0). 51 | BitBuffer(); 52 | 53 | 54 | 55 | /*---- Methods ----*/ 56 | public: 57 | 58 | // Returns the number of bits in the buffer, which is a non-negative value. 59 | int getBitLength() const; 60 | 61 | 62 | // Returns a copy of all bytes, padding up to the nearest byte. 63 | std::vector getBytes() const; 64 | 65 | 66 | // Appends the given number of bits of the given value to this sequence. 67 | // If 0 <= len <= 31, then this requires 0 <= val < 2^len. 68 | void appendBits(uint32_t val, int len); 69 | 70 | 71 | // Appends the data of the given segment to this bit buffer. 72 | void appendData(const QrSegment &seg); 73 | 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /lib/QRCode/tests/README.md: -------------------------------------------------------------------------------- 1 | Testing 2 | ======= 3 | 4 | The testcases work by using the Nayuki QR code generating library, generating a QR code 5 | in both libraries and comparing them. 6 | 7 | Running 8 | ------- 9 | 10 | ``` 11 | ./run.sh 12 | ``` 13 | -------------------------------------------------------------------------------- /lib/QRCode/tests/run-tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../src/qrcode.h" 5 | #include "QrCode.hpp" 6 | 7 | static uint32_t check(const qrcodegen::QrCode &nayuki, QRCode *ricmoo) { 8 | uint32_t wrong = 0; 9 | 10 | if (nayuki.size != ricmoo->size) { wrong += (1 << 20); } 11 | 12 | int border = 4; 13 | for (int y = -border; y < nayuki.size + border; y++) { 14 | for (int x = -border; x < nayuki.size + border; x++) { 15 | if (!!nayuki.getModule(x, y) != qrcode_getModule(ricmoo, x, y)) { 16 | wrong++; 17 | } 18 | } 19 | } 20 | 21 | return wrong; 22 | } 23 | 24 | int main() { 25 | std::clock_t t0, totalNayuki, totalRicMoo; 26 | 27 | int total = 0, passed = 0; 28 | for (char version = 1; version <= 40; version++) { 29 | if (LOCK_VERSION != 0 && LOCK_VERSION != version) { continue; } 30 | 31 | for (char ecc = 0; ecc < 4; ecc++) { 32 | const qrcodegen::QrCode::Ecc *errCorLvl; 33 | switch (ecc) { 34 | case 0: 35 | errCorLvl = &qrcodegen::QrCode::Ecc::LOW; 36 | break; 37 | case 1: 38 | errCorLvl = &qrcodegen::QrCode::Ecc::MEDIUM; 39 | break; 40 | case 2: 41 | errCorLvl = &qrcodegen::QrCode::Ecc::QUARTILE; 42 | break; 43 | case 3: 44 | errCorLvl = &qrcodegen::QrCode::Ecc::HIGH; 45 | break; 46 | } 47 | 48 | for (char tc = 0; tc < 3; tc++) { 49 | char *data; 50 | switch(tc) { 51 | case 0: 52 | data = (char*)"HELLO"; 53 | break; 54 | case 1: 55 | data = (char*)"Hello"; 56 | break; 57 | case 2: 58 | data = (char*)"1234"; 59 | break; 60 | } 61 | t0 = std::clock(); 62 | const qrcodegen::QrCode nayuki = qrcodegen::QrCode::encodeText(data, version, *errCorLvl); 63 | totalNayuki += std::clock() - t0; 64 | 65 | t0 = std::clock(); 66 | QRCode ricmoo; 67 | uint8_t ricmooBytes[qrcode_getBufferSize(version)]; 68 | qrcode_initText(&ricmoo, ricmooBytes, version, ecc, data); 69 | totalRicMoo += std::clock() - t0; 70 | 71 | uint32_t badModules = check(nayuki, &ricmoo); 72 | if (badModules) { 73 | printf("Failed test case: version=%d, ecc=%d, data=\"%s\", faliured=%d\n", version, ecc, data, badModules); 74 | } else { 75 | passed++; 76 | } 77 | 78 | total++; 79 | } 80 | } 81 | } 82 | 83 | printf("Tests complete: %d passed (out of %d)\n", passed, total); 84 | printf("Timing: Nayuki=%lu, RicMoo=%lu\n", totalNayuki, totalRicMoo); 85 | } 86 | -------------------------------------------------------------------------------- /lib/QRCode/tests/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | clang++ run-tests.cpp QrCode.cpp QrSegment.cpp BitBuffer.cpp ../src/qrcode.c -o test && ./test 4 | clang++ run-tests.cpp QrCode.cpp QrSegment.cpp BitBuffer.cpp ../src/qrcode.c -o test -D LOCK_VERSION=3 && ./test 5 | 6 | -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /lib/Shell/examples/Shell_Basic/Shell_Basic.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * GeekFactory - "Construye tu propia tecnologia" 3 | * Distribucion de materiales para el desarrollo e innovacion tecnologica 4 | * www.geekfactory.mx 5 | * 6 | * Ejemplo de libreria Shell. Este ejemplo representa la configuracion minima 7 | * requerida para implementar la funcionalidad de interfaz de comandos. En esta 8 | * ocasion registramos 2 comandos y enviamos texto como respuesta a cada uno. 9 | * 10 | * Example for Shell library. This example shows the minimum setup needed to 11 | * implement a command line interface. This time we register 2 commands and we 12 | * send text as response for each command. 13 | */ 14 | 15 | #include 16 | 17 | void setup() 18 | { 19 | // Prepare serial communication 20 | Serial.begin(9600); 21 | // Wait after reset or power on... 22 | delay(1000); 23 | 24 | // Initialize command line interface (CLI) 25 | // We pass the function pointers to the read and write functions that we implement below 26 | // We can also pass a char pointer to display a custom start message 27 | shell_init(shell_reader, shell_writer, 0); 28 | 29 | // Add commands to the shell 30 | shell_register(command_mycommand, PSTR("mycommand")); 31 | shell_register(command_othercommand, PSTR("othercommand")); 32 | } 33 | 34 | void loop() 35 | { 36 | // This should always be called to process user input 37 | shell_task(); 38 | } 39 | 40 | /** 41 | * Test commands: The commands should always use this function prototype. 42 | * They receive 2 parameters: The total count of arguments (argc) and a pointer 43 | * to the begining of each one of the null-terminated argument strings. 44 | * 45 | * In this example we ignore the parameters passed to the functions 46 | */ 47 | int command_mycommand(int argc, char** argv) 48 | { 49 | shell_println("Running \"mycommand\" now"); 50 | shell_println("Exit..."); 51 | return SHELL_RET_SUCCESS; 52 | } 53 | 54 | int command_othercommand(int argc, char** argv) 55 | { 56 | shell_println("Running \"othercommand\" now"); 57 | shell_println("Exit..."); 58 | return SHELL_RET_SUCCESS; 59 | } 60 | 61 | /** 62 | * Function to read data from serial port 63 | * Functions to read from physical media should use this prototype: 64 | * int my_reader_function(char * data) 65 | */ 66 | int shell_reader(char * data) 67 | { 68 | // Wrapper for Serial.read() method 69 | if (Serial.available()) { 70 | *data = Serial.read(); 71 | return 1; 72 | } 73 | return 0; 74 | } 75 | 76 | /** 77 | * Function to write data to serial port 78 | * Functions to write to physical media should use this prototype: 79 | * void my_writer_function(char data) 80 | */ 81 | void shell_writer(char data) 82 | { 83 | // Wrapper for Serial.write() method 84 | Serial.write(data); 85 | } 86 | -------------------------------------------------------------------------------- /lib/Shell/examples/Shell_Command_Args/Shell_Command_Args.ino: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/lib/Shell/examples/Shell_Command_Args/Shell_Command_Args.ino -------------------------------------------------------------------------------- /lib/Shell/examples/Shell_Minimum/Shell_Minimum.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * GeekFactory - "Construye tu propia tecnologia" 3 | * Distribucion de materiales para el desarrollo e innovacion tecnologica 4 | * www.geekfactory.mx 5 | * 6 | * Ejemplo de libreria Shell. Este ejemplo representa la configuracion minima 7 | * requerida para implementar la funcionalidad de interfaz de comandos. 8 | * 9 | * Example for Shell library. This example shows the minimum setup needed to 10 | * implement a command line interface. 11 | */ 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | // Prepare serial communication 18 | Serial.begin(9600); 19 | // Wait after reset or power on... 20 | delay(1000); 21 | 22 | // Initialize command line interface (CLI) 23 | // We pass the function pointers to the read and write functions that we implement below 24 | // We can also pass a char pointer to display a custom start message 25 | shell_init(shell_reader, shell_writer, 0); 26 | 27 | // Add commands to the shell 28 | shell_register(command_example, PSTR("example")); 29 | } 30 | 31 | void loop() 32 | { 33 | // This should always be called to process user input 34 | shell_task(); 35 | } 36 | 37 | int command_example(int argc, char** argv) 38 | { 39 | // Do something here... 40 | 41 | // And exit 42 | return SHELL_RET_SUCCESS; 43 | } 44 | 45 | /** 46 | * Function to read data from serial port 47 | * Functions to read from physical media should use this prototype: 48 | * int my_reader_function(char * data) 49 | */ 50 | int shell_reader(char * data) 51 | { 52 | // Wrapper for Serial.read() method 53 | if (Serial.available()) { 54 | *data = Serial.read(); 55 | return 1; 56 | } 57 | return 0; 58 | } 59 | 60 | /** 61 | * Function to write data to serial port 62 | * Functions to write to physical media should use this prototype: 63 | * void my_writer_function(char data) 64 | */ 65 | void shell_writer(char data) 66 | { 67 | // Wrapper for Serial.write() method 68 | Serial.write(data); 69 | } 70 | -------------------------------------------------------------------------------- /lib/Shell/examples/Shell_RGB_Control/Shell_RGB_Control.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * GeekFactory - "Construye tu propia tecnologia" 3 | * Distribucion de materiales para el desarrollo e innovacion tecnologica 4 | * www.geekfactory.mx 5 | * 6 | * Ejemplo de libreria Shell. Este ejemplo permite controlar el color mostrado 7 | * en un led RGB conectado a los pines PWM mediante comandos de texto. El programa 8 | * admite 3 parametros de 0 a 255 que representan la intensidad de cada led (RGB). 9 | * 10 | * Example for Shell library. This example controls the color displayed on the RGB 11 | * led connected to PWM pins using text commands. The program accepts 3 parameters 12 | * in a range from 0 to 255 that represent the intensity of each led. 13 | */ 14 | 15 | #include 16 | 17 | void setup() 18 | { 19 | // Prepare serial communication 20 | Serial.begin(9600); 21 | // Wait after reset or power on... 22 | delay(1000); 23 | 24 | // Pins to connect RGB led (PWM outputs) 25 | pinMode(3,OUTPUT); 26 | pinMode(5,OUTPUT); 27 | pinMode(6,OUTPUT); 28 | pinMode(9,OUTPUT); 29 | 30 | // Initialize command line interface (CLI) 31 | // We pass the function pointers to the read and write functions that we implement below 32 | // We can also pass a char pointer to display a custom start message 33 | shell_init(shell_reader, shell_writer, 0); 34 | 35 | // Add commands to the shell 36 | shell_register(command_rgbled, PSTR("rgbled")); 37 | } 38 | 39 | void loop() 40 | { 41 | // This should always be called to process user input 42 | shell_task(); 43 | } 44 | 45 | /** 46 | * This function implements the rgbled command and parses the required args 47 | * Type: rgbled 255 255 255 to set led to maximum brigtness 48 | * Type: rgbled 0 0 0 to set led to minimum brightess 49 | */ 50 | int command_rgbled(int argc, char** argv) 51 | { 52 | // Variables that store parameter values 53 | uint8_t val_R, val_G, val_B; 54 | 55 | // Parse RGB values and write to PWM pins 56 | val_R = strtol(argv[1],NULL,0); 57 | analogWrite(3, val_R); 58 | 59 | val_G = strtol(argv[2],NULL,0); 60 | analogWrite(5, val_G); 61 | 62 | val_B = strtol(argv[3],NULL,0); 63 | analogWrite(6, val_B); 64 | 65 | val_B = strtol(argv[4],NULL,0); 66 | analogWrite(9, val_B); 67 | 68 | // Print the received falues to the terminal screen 69 | shell_printf("#RGB-COMPONENTS:%d,%d,%d\r\n", val_R, val_G, val_B); 70 | 71 | // Return success code 72 | return SHELL_RET_SUCCESS; 73 | } 74 | 75 | /** 76 | * Function to read data from serial port 77 | * Functions to read from physical media should use this prototype: 78 | * int my_reader_function(char * data) 79 | */ 80 | int shell_reader(char * data) 81 | { 82 | // Wrapper for Serial.read() method 83 | if (Serial.available()) { 84 | *data = Serial.read(); 85 | return 1; 86 | } 87 | return 0; 88 | } 89 | 90 | /** 91 | * Function to write data to serial port 92 | * Functions to write to physical media should use this prototype: 93 | * void my_writer_function(char data) 94 | */ 95 | void shell_writer(char data) 96 | { 97 | // Wrapper for Serial.write() method 98 | Serial.write(data); 99 | } 100 | 101 | 102 | -------------------------------------------------------------------------------- /lib/Shell/examples/Shell_Telnet/Shell_Telnet.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * GeekFactory - "Construye tu propia tecnologia" 3 | * Distribucion de materiales para el desarrollo e innovacion tecnologica 4 | * www.geekfactory.mx 5 | * 6 | * Ejemplo de libreria Shell. Este ejemplo permite controlar el color mostrado 7 | * en un led RGB conectado a los pines PWM mediante comandos de texto. El programa 8 | * admite 3 parametros de 0 a 255 que representan la intensidad de cada led (RGB). 9 | * Esta version del programa permite el control remoto a traves de un shield Ethernet 10 | * y demuestra la capacidad de la libreria para redirigir la entrada y salida de datos 11 | * desde y hacia cualquier medio. 12 | * 13 | * Example for Shell library. This example controls the color displayed on the RGB 14 | * led connected to PWM pins using text commands. The program accepts 3 parameters 15 | * in a range from 0 to 255 that represent the intensity of each led. 16 | * This version of the program allows the remote control through the Ethernet Shield 17 | * and shows the capacity of the library to redirect data input and output to any 18 | * physical medium. 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | // Ethernet and TCP/IP protocol configuration 26 | byte mac[] = { 27 | 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 28 | 29 | byte ip[] = { 30 | 192, 168, 1, 177 }; 31 | 32 | byte gateway[] = { 33 | 192, 168, 1, 254 }; 34 | 35 | byte subnet[] = { 36 | 255, 255, 255, 0 }; 37 | 38 | // Create the server instance on port 23 (default port for telnet protocol) 39 | EthernetServer server = EthernetServer(23); 40 | // The client that is willing to connect to server 41 | EthernetClient client; 42 | 43 | 44 | void setup() 45 | { 46 | // Prepare serial communication 47 | Serial.begin(9600); 48 | // Setup ethernet shield 49 | Ethernet.begin(mac, ip, gateway, subnet); 50 | // Start TCP Server on port 23 51 | server.begin(); 52 | // Wait after reset or power on... 53 | delay(1000); 54 | 55 | // Pins to connect RGB led (PWM outputs) 56 | pinMode(3,OUTPUT); 57 | pinMode(5,OUTPUT); 58 | pinMode(6,OUTPUT); 59 | 60 | // Initialize command line interface (CLI) 61 | // We pass the function pointers to the read and write functions that we implement below 62 | // We can also pass a char pointer to display a custom start message 63 | shell_init(shell_reader, shell_writer, 0); 64 | 65 | // Add commands to the shell 66 | shell_register(command_rgbled, PSTR("rgbled")); 67 | 68 | } 69 | 70 | void loop() 71 | { 72 | // Check if a client is willing to connect and get client object 73 | client = server.available(); 74 | // This should always be called to process user input 75 | shell_task(); 76 | } 77 | 78 | /** 79 | * This function implements the rgbled command and parses the required args 80 | * Type: rgbled 255 255 255 to set led to maximum brigtness 81 | * Type: rgbled 0 0 0 to set led to minimum brightess 82 | */ 83 | int command_rgbled(int argc, char** argv) 84 | { 85 | // Variables that store parameter values 86 | uint8_t val_R, val_G, val_B; 87 | 88 | // Parse RGB values and write to PWM pins 89 | val_R = strtol(argv[1],NULL,0); 90 | analogWrite(3, val_R); 91 | 92 | val_G = strtol(argv[2],NULL,0); 93 | analogWrite(5, val_G); 94 | 95 | val_B = strtol(argv[3],NULL,0); 96 | analogWrite(6, val_B); 97 | 98 | // Print the received falues to the terminal screen 99 | shell_printf("#RGB-COMPONENTS:%d,%d,%d\r\n", val_R, val_G, val_B); 100 | 101 | // Return success code 102 | return SHELL_RET_SUCCESS; 103 | } 104 | 105 | /** 106 | * Function to read data from serial port 107 | * Functions to read from physical media should use this prototype: 108 | * int my_reader_function(char * data) 109 | */ 110 | int shell_reader(char * data) 111 | { 112 | int ret = 0; 113 | // If a client is available and it´s connected 114 | if (client==true && client.connected()) { 115 | // Client has data? 116 | if (client.available()) { 117 | // Read data from client 118 | *data = client.read(); 119 | ret = 1; 120 | } 121 | } 122 | else 123 | { 124 | client.stop(); 125 | } 126 | return ret; 127 | } 128 | 129 | /** 130 | * Function to write data to serial port 131 | * Functions to write to physical media should use this prototype: 132 | * void my_writer_function(char data) 133 | */ 134 | void shell_writer(char data) 135 | { 136 | // If we can write to a client 137 | if(client==true && client.connected()) 138 | { 139 | // Wrapper for Serial.write() method 140 | client.write(data); 141 | } 142 | } 143 | 144 | 145 | -------------------------------------------------------------------------------- /lib/Shell/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for Shell 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | shell_init KEYWORD2 13 | shell_use_buffered_output KEYWORD2 14 | shell_register KEYWORD2 15 | shell_unregister_all KEYWORD2 16 | shell_putc KEYWORD2 17 | shell_print KEYWORD2 18 | shell_println KEYWORD2 19 | shell_printf KEYWORD2 20 | shell_print_commands KEYWORD2 21 | shell_print_error KEYWORD2 22 | shell_task KEYWORD2 23 | shell_print_pm KEYWORD2 24 | shell_println_pm KEYWORD2 25 | shell_printf_pm KEYWORD2 26 | 27 | ####################################### 28 | # Instances (KEYWORD2) 29 | ####################################### 30 | 31 | ####################################### 32 | # Constants (LITERAL1) 33 | ####################################### 34 | -------------------------------------------------------------------------------- /lib/Shell/library.properties: -------------------------------------------------------------------------------- 1 | name=GeekFactory Shell Library 2 | version=1.2.0 3 | author=www.geekfactory.mx 4 | maintainer=Jesus Ruben Santa Anna Zamudio 5 | sentence=Library to create a simple Command Line Interface (CLI). 6 | paragraph=This library allows the user to control the device using simple text commands, the library is written in pure C so it can be easily ported to other microcontrollers. 7 | category=Communication 8 | url=https://github.com/geekfactory/Shell 9 | architectures=* 10 | -------------------------------------------------------------------------------- /lib/U8g2/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The U8g2lib code (http://code.google.com/p/u8g2/ and 3 | https://github.com/olikraus/U8g2_Arduino) is licensed under the terms of 4 | the new-bsd license (two-clause bsd license). 5 | See also: http://www.opensource.org/licenses/bsd-license.php 6 | 7 | The repository and optionally the releases contain icons, which are 8 | derived from the WPZOOM Developer Icon Set: 9 | http://www.wpzoom.com/wpzoom/new-freebie-wpzoom-developer-icon-set-154-free-icons/ 10 | WPZOOM Developer Icon Set by WPZOOM is licensed under a Creative Commons 11 | Attribution-ShareAlike 3.0 Unported License. 12 | 13 | Fonts are licensed under different conditions. 14 | See 15 | https://github.com/olikraus/u8g2/wiki/fntgrp 16 | for detailed information on the licensing conditions for each font. 17 | 18 | ============ X11 Fonts COUR, HELV, NCEN, TIM, SYMB ============ 19 | 20 | For fonts derived from the following files, the license below applies. 21 | COURB08.BDF COURB10.BDF COURB12.BDF COURB14.BDF COURB18.BDF 22 | COURB24.BDF COURR08.BDF COURR10.BDF COURR12.BDF COURR14.BDF 23 | COURR18.BDF COURR24.BDF HELVB08.BDF HELVB10.BDF HELVB12.BDF HELVB14.BDF 24 | HELVB18.BDF HELVB24.BDF HELVR08.BDF HELVR10.BDF HELVR12.BDF HELVR14.BDF 25 | HELVR18.BDF HELVR24.BDF NCENB08.BDF NCENB10.BDF NCENB12.BDF 26 | NCENB14.BDF NCENB18.BDF NCENB24.BDF NCENR08.BDF NCENR10.BDF 27 | NCENR12.BDF NCENR14.BDF NCENR18.BDF NCENR24.BDF SYMB08.BDF SYMB10.BDF 28 | SYMB12.BDF SYMB14.BDF SYMB18.BDF SYMB24.BDF TIMB08.BDF TIMB10.BDF 29 | TIMB12.BDF TIMB14.BDF TIMB18.BDF TIMB24.BDF TIMR08.BDF TIMR10.BDF 30 | TIMR12.BDF TIMR14.BDF TIMR18.BDF TIMR24.BDF 31 | 32 | Copyright 1984-1989, 1994 Adobe Systems Incorporated. 33 | Copyright 1988, 1994 Digital Equipment Corporation. 34 | 35 | Adobe is a trademark of Adobe Systems Incorporated which may be 36 | registered in certain jurisdictions. 37 | Permission to use these trademarks is hereby granted only in 38 | association with the images described in this file. 39 | 40 | Permission to use, copy, modify, distribute and sell this software 41 | and its documentation for any purpose and without fee is hereby 42 | granted, provided that the above copyright notices appear in all 43 | copies and that both those copyright notices and this permission 44 | notice appear in supporting documentation, and that the names of 45 | Adobe Systems and Digital Equipment Corporation not be used in 46 | advertising or publicity pertaining to distribution of the software 47 | without specific, written prior permission. Adobe Systems and 48 | Digital Equipment Corporation make no representations about the 49 | suitability of this software for any purpose. It is provided "as 50 | is" without express or implied warranty. 51 | 52 | 53 | ============ BSD License for U8g2lib Code ============ 54 | 55 | Universal 8bit Graphics Library (http://code.google.com/p/u8g2/ and 56 | https://github.com/olikraus/U8g2_Arduino) 57 | 58 | Copyright (c) 2016, olikraus@gmail.com 59 | All rights reserved. 60 | 61 | Redistribution and use in source and binary forms, with or without modification, 62 | are permitted provided that the following conditions are met: 63 | 64 | * Redistributions of source code must retain the above copyright notice, this list 65 | of conditions and the following disclaimer. 66 | 67 | * Redistributions in binary form must reproduce the above copyright notice, this 68 | list of conditions and the following disclaimer in the documentation and/or other 69 | materials provided with the distribution. 70 | 71 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 72 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 73 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 74 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 75 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 76 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 77 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 78 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 79 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 80 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 81 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 82 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 83 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 84 | 85 | -------------------------------------------------------------------------------- /lib/U8g2/README.md: -------------------------------------------------------------------------------- 1 | # U8g2_Arduino: Arduino Monochrome Graphics Library 2 | 3 | ![https://raw.githubusercontent.com/wiki/olikraus/u8g2/img/uc1701_dogs102_uno_board_320.jpg](https://raw.githubusercontent.com/wiki/olikraus/u8g2/img/uc1701_dogs102_uno_board_320.jpg) 4 | 5 | U8glib V2 library for Arduino 6 | 7 | Description: https://github.com/olikraus/u8g2/wiki 8 | 9 | Issue Tracker: https://github.com/olikraus/u8g2/issues 10 | 11 | Download (2.25.10): https://github.com/olikraus/U8g2_Arduino/archive/master.zip 12 | 13 | -------------------------------------------------------------------------------- /lib/U8g2/examples/u8x8/ArduboyTest/ArduboyTest.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Arduboy.ino 4 | 5 | Arduboy Test Example with U8x8 6 | 7 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 8 | 9 | Copyright (c) 2016, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | */ 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef U8X8_HAVE_HW_SPI 43 | #include 44 | #endif 45 | 46 | // Arduboy 10 (Production, Kickstarter Edition) 47 | U8X8_SSD1306_128X64_NONAME_4W_HW_SPI u8x8(/* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6); 48 | 49 | ArduboyCore arduboyCore; 50 | ArduboyAudio arduboyAudio; 51 | ArduboyTunes arduboyTunes; 52 | 53 | void setup(void) 54 | { 55 | //u8x8.begin(/*Select=*/ A0, /*Right/Next=*/ 5, /*Left/Prev=*/ 9, /*Up=*/ 8, /*Down=*/ 10, /*Home/Cancel=*/ A1); // Arduboy DevKit 56 | u8x8.begin(/*Select=*/ 7, /*Right/Next=*/ A1, /*Left/Prev=*/ A2, /*Up=*/ A0, /*Down=*/ A3, /*Home/Cancel=*/ 8); // Arduboy 10 (Production) 57 | 58 | arduboyTunes.initChannel(PIN_SPEAKER_1); 59 | arduboyTunes.initChannel(PIN_SPEAKER_2); 60 | arduboyAudio.begin(); 61 | } 62 | 63 | void msg(const char *txt) 64 | { 65 | u8x8.clear(); 66 | u8x8.print(txt); 67 | } 68 | 69 | void loop(void) 70 | { 71 | static uint8_t c = 1; 72 | static uint8_t b = 0; 73 | u8x8.setFont(u8x8_font_chroma48medium8_r); 74 | c = u8x8.userInterfaceSelectionList("Arduboy Test\n", c, "LED Test\nButton Test\nSpeaker Test"); 75 | if ( c == 1 ) 76 | { 77 | msg("LED Test"); 78 | arduboyCore.setRGBled(255, 0, 0); 79 | delay(500); 80 | arduboyCore.setRGBled(0, 255, 0); // green is not there ??? 81 | delay(500); 82 | arduboyCore.setRGBled(0, 0, 255); 83 | delay(500); 84 | arduboyCore.setRGBled(0, 0, 0); 85 | } 86 | else if ( c == 2 ) 87 | { 88 | u8x8.clear(); 89 | for(;;) 90 | { 91 | u8x8.drawUTF8(0, 0, "Button Test"); 92 | b = arduboyCore.buttonsState(); 93 | 94 | u8x8.noInverse(); 95 | if ( b & A_BUTTON ) 96 | u8x8.inverse(); 97 | u8x8.drawUTF8(0, 1, "A Button"); 98 | 99 | u8x8.noInverse(); 100 | if ( b & B_BUTTON ) 101 | u8x8.inverse(); 102 | u8x8.drawUTF8(0, 2, "B Button"); 103 | 104 | u8x8.noInverse(); 105 | if ( b & UP_BUTTON ) 106 | u8x8.inverse(); 107 | u8x8.drawUTF8(0, 3, "UP Button"); 108 | 109 | u8x8.noInverse(); 110 | if ( b & DOWN_BUTTON ) 111 | u8x8.inverse(); 112 | u8x8.drawUTF8(0, 4, "DOWN Button"); 113 | 114 | u8x8.noInverse(); 115 | if ( b & LEFT_BUTTON ) 116 | u8x8.inverse(); 117 | u8x8.drawUTF8(0, 5, "LEFT Button"); 118 | 119 | u8x8.noInverse(); 120 | if ( b & RIGHT_BUTTON ) 121 | u8x8.inverse(); 122 | u8x8.drawUTF8(0, 6, "RIGHT Button"); 123 | 124 | u8x8.noInverse(); 125 | u8x8.drawUTF8(0, 7, "Quit: A&B Button"); 126 | 127 | if ( (b & A_BUTTON) && (b & B_BUTTON) ) 128 | break; 129 | } 130 | } 131 | else if ( c == 3 ) 132 | { 133 | u8x8.clear(); 134 | u8x8.drawUTF8(0, 0, "Speaker Test"); 135 | arduboyTunes.tone(1000, 1000); 136 | delay(1000); 137 | arduboyTunes.tone(2000, 1000); 138 | delay(1000); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /lib/U8g2/library.properties: -------------------------------------------------------------------------------- 1 | name=U8g2 2 | version=2.25.10 3 | author=oliver 4 | maintainer=oliver 5 | sentence=Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7567, ST7588, ST75256, NT7534, IST3020, ST7920, LD7032, KS0108, SED1520, SBN1661, IL3820, MAX7219. Interfaces: I2C, SPI, Parallel. 6 | paragraph=Monochrome LCD, OLED and eInk Library. Successor of U8glib. Supported display controller: SSD1305, SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7567, ST7588, ST75256, NT7534, IST3020, ST7920, LD7032, KS0108, SED1520, SBN1661, IL3820, MAX7219. Supported interfaces: I2C, SPI, Parallel. Features: UTF8, >700 fonts, U8x8 char output. 7 | category=Display 8 | url=https://github.com/olikraus/u8g2 9 | architectures=* 10 | license=BSD-2-Clause 11 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8g2_cleardisplay.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g2_cleardisplay.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | #include "u8g2.h" 36 | 37 | /* Clear screen buffer & display reliable for all u8g2 displays. */ 38 | /* This is done with u8g2 picture loop, because we can not use the u8x8 function in all cases */ 39 | void u8g2_ClearDisplay(u8g2_t *u8g2) 40 | { 41 | u8g2_FirstPage(u8g2); 42 | do { 43 | } while ( u8g2_NextPage(u8g2) ); 44 | /* 45 | This function is usually called during startup (u8g2.begin()). 46 | However the user might want to use full buffer mode with clear and 47 | send commands. 48 | This will not work because the current tile row is modified by the picture 49 | loop above. To fix this, reset the tile row to 0, issue #370 50 | A workaround would be, that the user sets the current tile row to 0 manually. 51 | */ 52 | u8g2_SetBufferCurrTileRow(u8g2, 0); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8g2_fonts.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/lib/U8g2/src/clib/u8g2_fonts.c -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8g2_input_value.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g2_input_value.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #include "u8g2.h" 37 | 38 | /* 39 | return: 40 | 0: value is not changed (HOME/Break Button pressed) 41 | 1: value has been updated 42 | */ 43 | 44 | uint8_t u8g2_UserInterfaceInputValue(u8g2_t *u8g2, const char *title, const char *pre, uint8_t *value, uint8_t lo, uint8_t hi, uint8_t digits, const char *post) 45 | { 46 | uint8_t line_height; 47 | uint8_t height; 48 | u8g2_uint_t pixel_height; 49 | u8g2_uint_t y, yy; 50 | u8g2_uint_t pixel_width; 51 | u8g2_uint_t x, xx; 52 | 53 | uint8_t local_value = *value; 54 | //uint8_t r; /* not used ??? */ 55 | uint8_t event; 56 | 57 | /* only horizontal strings are supported, so force this here */ 58 | u8g2_SetFontDirection(u8g2, 0); 59 | 60 | /* force baseline position */ 61 | u8g2_SetFontPosBaseline(u8g2); 62 | 63 | /* calculate line height */ 64 | line_height = u8g2_GetAscent(u8g2); 65 | line_height -= u8g2_GetDescent(u8g2); 66 | 67 | 68 | /* calculate overall height of the input value box */ 69 | height = 1; /* value input line */ 70 | height += u8x8_GetStringLineCnt(title); 71 | 72 | /* calculate the height in pixel */ 73 | pixel_height = height; 74 | pixel_height *= line_height; 75 | 76 | 77 | /* calculate offset from top */ 78 | y = 0; 79 | if ( pixel_height < u8g2_GetDisplayHeight(u8g2) ) 80 | { 81 | y = u8g2_GetDisplayHeight(u8g2); 82 | y -= pixel_height; 83 | y /= 2; 84 | } 85 | 86 | /* calculate offset from left for the label */ 87 | x = 0; 88 | pixel_width = u8g2_GetUTF8Width(u8g2, pre); 89 | pixel_width += u8g2_GetUTF8Width(u8g2, "0") * digits; 90 | pixel_width += u8g2_GetUTF8Width(u8g2, post); 91 | if ( pixel_width < u8g2_GetDisplayWidth(u8g2) ) 92 | { 93 | x = u8g2_GetDisplayWidth(u8g2); 94 | x -= pixel_width; 95 | x /= 2; 96 | } 97 | 98 | /* event loop */ 99 | for(;;) 100 | { 101 | u8g2_FirstPage(u8g2); 102 | do 103 | { 104 | /* render */ 105 | yy = y; 106 | yy += u8g2_DrawUTF8Lines(u8g2, 0, yy, u8g2_GetDisplayWidth(u8g2), line_height, title); 107 | xx = x; 108 | xx += u8g2_DrawUTF8(u8g2, xx, yy, pre); 109 | xx += u8g2_DrawUTF8(u8g2, xx, yy, u8x8_u8toa(local_value, digits)); 110 | u8g2_DrawUTF8(u8g2, xx, yy, post); 111 | } while( u8g2_NextPage(u8g2) ); 112 | 113 | #ifdef U8G2_REF_MAN_PIC 114 | return 0; 115 | #endif 116 | 117 | for(;;) 118 | { 119 | event = u8x8_GetMenuEvent(u8g2_GetU8x8(u8g2)); 120 | if ( event == U8X8_MSG_GPIO_MENU_SELECT ) 121 | { 122 | *value = local_value; 123 | return 1; 124 | } 125 | else if ( event == U8X8_MSG_GPIO_MENU_HOME ) 126 | { 127 | return 0; 128 | } 129 | else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_UP ) 130 | { 131 | if ( local_value >= hi ) 132 | local_value = lo; 133 | else 134 | local_value++; 135 | break; 136 | } 137 | else if ( event == U8X8_MSG_GPIO_MENU_PREV || event == U8X8_MSG_GPIO_MENU_DOWN ) 138 | { 139 | if ( local_value <= lo ) 140 | local_value = hi; 141 | else 142 | local_value--; 143 | break; 144 | } 145 | } 146 | } 147 | 148 | /* never reached */ 149 | //return r; 150 | } 151 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8g2_intersection.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g2_intersection.c 4 | 5 | Intersection calculation, code taken from u8g_clip.c 6 | 7 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 8 | 9 | Copyright (c) 2016, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | */ 37 | 38 | #include "u8g2.h" 39 | 40 | #ifdef __GNUC__ 41 | #define U8G2_ALWAYS_INLINE __inline__ __attribute__((always_inline)) 42 | #else 43 | #define U8G2_ALWAYS_INLINE 44 | #endif 45 | 46 | 47 | #if defined(U8G2_WITH_INTERSECTION) || defined(U8G2_WITH_CLIP_WINDOW_SUPPORT) 48 | 49 | #ifdef OLD_VERSION_WITH_SYMETRIC_BOUNDARIES 50 | 51 | /* 52 | intersection assumptions: 53 | a1 <= a2 is always true 54 | 55 | minimized version 56 | ---1----0 1 b1 <= a2 && b1 > b2 57 | -----1--0 1 b2 >= a1 && b1 > b2 58 | ---1-1--- 1 b1 <= a2 && b2 >= a1 59 | */ 60 | 61 | 62 | /* 63 | calculate the intersection between a0/a1 and v0/v1 64 | The intersection check returns one if the range of a0/a1 has an intersection with v0/v1. 65 | The intersection check includes the boundary values v1 and a1. 66 | 67 | The following asserts will succeed: 68 | assert( u8g2_is_intersection_decision_tree(4, 6, 7, 9) == 0 ); 69 | assert( u8g2_is_intersection_decision_tree(4, 6, 6, 9) != 0 ); 70 | assert( u8g2_is_intersection_decision_tree(6, 9, 4, 6) != 0 ); 71 | assert( u8g2_is_intersection_decision_tree(7, 9, 4, 6) == 0 ); 72 | */ 73 | 74 | //static uint8_t U8G2_ALWAYS_INLINE u8g2_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 75 | static uint8_t u8g2_is_intersection_decision_tree(u8g2_uint_t a0, u8g2_uint_t a1, u8g2_uint_t v0, u8g2_uint_t v1) 76 | { 77 | if ( v0 <= a1 ) 78 | { 79 | if ( v1 >= a0 ) 80 | { 81 | return 1; 82 | } 83 | else 84 | { 85 | if ( v0 > v1 ) 86 | { 87 | return 1; 88 | } 89 | else 90 | { 91 | return 0; 92 | } 93 | } 94 | } 95 | else 96 | { 97 | if ( v1 >= a0 ) 98 | { 99 | if ( v0 > v1 ) 100 | { 101 | return 1; 102 | } 103 | else 104 | { 105 | return 0; 106 | } 107 | } 108 | else 109 | { 110 | return 0; 111 | } 112 | } 113 | } 114 | 115 | #endif /* OLD_VERSION_WITH_SYMETRIC_BOUNDARIES */ 116 | 117 | 118 | /* 119 | version with asymetric boundaries. 120 | a1 and v1 are excluded 121 | v0 == v1 is not support end return 1 122 | */ 123 | uint8_t u8g2_is_intersection_decision_tree(u8g2_uint_t a0, u8g2_uint_t a1, u8g2_uint_t v0, u8g2_uint_t v1) 124 | { 125 | if ( v0 < a1 ) // v0 <= a1 126 | { 127 | if ( v1 > a0 ) // v1 >= a0 128 | { 129 | return 1; 130 | } 131 | else 132 | { 133 | if ( v0 > v1 ) // v0 > v1 134 | { 135 | return 1; 136 | } 137 | else 138 | { 139 | return 0; 140 | } 141 | } 142 | } 143 | else 144 | { 145 | if ( v1 > a0 ) // v1 >= a0 146 | { 147 | if ( v0 > v1 ) // v0 > v1 148 | { 149 | return 1; 150 | } 151 | else 152 | { 153 | return 0; 154 | } 155 | } 156 | else 157 | { 158 | return 0; 159 | } 160 | } 161 | } 162 | 163 | 164 | 165 | /* upper limits are not included (asymetric boundaries) */ 166 | uint8_t u8g2_IsIntersection(u8g2_t *u8g2, u8g2_uint_t x0, u8g2_uint_t y0, u8g2_uint_t x1, u8g2_uint_t y1) 167 | { 168 | if ( u8g2_is_intersection_decision_tree(u8g2->user_y0, u8g2->user_y1, y0, y1) == 0 ) 169 | return 0; 170 | 171 | return u8g2_is_intersection_decision_tree(u8g2->user_x0, u8g2->user_x1, x0, x1); 172 | } 173 | 174 | 175 | #endif /* U8G2_WITH_INTERSECTION */ 176 | 177 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8g2_kerning.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g2_kerning.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #include "u8g2.h" 37 | 38 | /* this function is used as "u8g2_get_kerning_cb" */ 39 | /* 40 | uint8_t u8g2_GetNullKerning(u8g2_t *u8g2, uint16_t e1, uint16_t e2) 41 | { 42 | return 0; 43 | } 44 | */ 45 | 46 | /* this function is used as "u8g2_get_kerning_cb" */ 47 | uint8_t u8g2_GetKerning(U8X8_UNUSED u8g2_t *u8g2, u8g2_kerning_t *kerning, uint16_t e1, uint16_t e2) 48 | { 49 | uint16_t i1, i2, cnt, end; 50 | if ( kerning == NULL ) 51 | return 0; 52 | 53 | /* search for the encoding in the first table */ 54 | cnt = kerning->first_table_cnt; 55 | cnt--; /* ignore the last element of the table, which is 0x0ffff */ 56 | for( i1 = 0; i1 < cnt; i1++ ) 57 | { 58 | if ( kerning->first_encoding_table[i1] == e1 ) 59 | break; 60 | } 61 | if ( i1 >= cnt ) 62 | return 0; /* e1 not part of the kerning table, return 0 */ 63 | 64 | /* get the upper index for i2 */ 65 | end = kerning->index_to_second_table[i1+1]; 66 | for( i2 = kerning->index_to_second_table[i1]; i2 < end; i2++ ) 67 | { 68 | if ( kerning->second_encoding_table[i2] == e2 ) 69 | break; 70 | } 71 | 72 | if ( i2 >= end ) 73 | return 0; /* e2 not part of any pair with e1, return 0 */ 74 | 75 | return kerning->kerning_values[i2]; 76 | } 77 | 78 | uint8_t u8g2_GetKerningByTable(U8X8_UNUSED u8g2_t *u8g2, const uint16_t *kt, uint16_t e1, uint16_t e2) 79 | { 80 | uint16_t i; 81 | i = 0; 82 | if ( kt == NULL ) 83 | return 0; 84 | for(;;) 85 | { 86 | if ( kt[i] == 0x0ffff ) 87 | break; 88 | if ( kt[i] == e1 && kt[i+1] == e2 ) 89 | return kt[i+2]; 90 | i+=3; 91 | } 92 | return 0; 93 | } 94 | 95 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8g2_line.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g2_box.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #include "u8g2.h" 37 | 38 | 39 | void u8g2_DrawLine(u8g2_t *u8g2, u8g2_uint_t x1, u8g2_uint_t y1, u8g2_uint_t x2, u8g2_uint_t y2) 40 | { 41 | u8g2_uint_t tmp; 42 | u8g2_uint_t x,y; 43 | u8g2_uint_t dx, dy; 44 | u8g2_int_t err; 45 | u8g2_int_t ystep; 46 | 47 | uint8_t swapxy = 0; 48 | 49 | /* no intersection check at the moment, should be added... */ 50 | 51 | if ( x1 > x2 ) dx = x1-x2; else dx = x2-x1; 52 | if ( y1 > y2 ) dy = y1-y2; else dy = y2-y1; 53 | 54 | if ( dy > dx ) 55 | { 56 | swapxy = 1; 57 | tmp = dx; dx =dy; dy = tmp; 58 | tmp = x1; x1 =y1; y1 = tmp; 59 | tmp = x2; x2 =y2; y2 = tmp; 60 | } 61 | if ( x1 > x2 ) 62 | { 63 | tmp = x1; x1 =x2; x2 = tmp; 64 | tmp = y1; y1 =y2; y2 = tmp; 65 | } 66 | err = dx >> 1; 67 | if ( y2 > y1 ) ystep = 1; else ystep = -1; 68 | y = y1; 69 | 70 | #ifndef U8G2_16BIT 71 | if ( x2 == 255 ) 72 | x2--; 73 | #else 74 | if ( x2 == 0xffff ) 75 | x2--; 76 | #endif 77 | 78 | for( x = x1; x <= x2; x++ ) 79 | { 80 | if ( swapxy == 0 ) 81 | u8g2_DrawPixel(u8g2, x, y); 82 | else 83 | u8g2_DrawPixel(u8g2, y, x); 84 | err -= (uint8_t)dy; 85 | if ( err < 0 ) 86 | { 87 | y += (u8g2_uint_t)ystep; 88 | err += (u8g2_uint_t)dx; 89 | } 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8log_u8g2.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8log_u8g2.c 4 | 5 | 6 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 7 | 8 | Copyright (c) 2018, olikraus@gmail.com 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | * Redistributions of source code must retain the above copyright notice, this list 15 | of conditions and the following disclaimer. 16 | 17 | * Redistributions in binary form must reproduce the above copyright notice, this 18 | list of conditions and the following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 33 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | */ 36 | 37 | #include "u8g2.h" 38 | /* 39 | Draw the u8log text at the specified x/y position. 40 | x/y position is the reference position of the first char of the first line. 41 | the line height is 42 | u8g2_GetAscent(u8g2) - u8g2_GetDescent(u8g2) + line_height_offset; 43 | line_height_offset can be set with u8log_SetLineHeightOffset() 44 | Use 45 | u8g2_SetFontRefHeightText(u8g2_t *u8g2); 46 | u8g2_SetFontRefHeightExtendedText(u8g2_t *u8g2); 47 | u8g2_SetFontRefHeightAll(u8g2_t *u8g2); 48 | to change the return values for u8g2_GetAscent and u8g2_GetDescent 49 | 50 | */ 51 | void u8g2_DrawLog(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8log_t *u8log) 52 | { 53 | u8g2_uint_t disp_x, disp_y; 54 | uint8_t buf_x, buf_y; 55 | uint8_t c; 56 | 57 | disp_y = y; 58 | u8g2_SetFontDirection(u8g2, 0); 59 | for( buf_y = 0; buf_y < u8log->height; buf_y++ ) 60 | { 61 | disp_x = x; 62 | for( buf_x = 0; buf_x < u8log->width; buf_x++ ) 63 | { 64 | c = u8log->screen_buffer[buf_y * u8log->width + buf_x]; 65 | disp_x += u8g2_DrawGlyph(u8g2, disp_x, disp_y, c); 66 | } 67 | disp_y += u8g2_GetAscent(u8g2) - u8g2_GetDescent(u8g2); 68 | disp_y += u8log->line_height_offset; 69 | } 70 | } 71 | 72 | /* 73 | u8lib callback for u8g2 74 | 75 | Only font direction 0 is supported: u8g2_SetFontDirection(u8g2, 0) 76 | Use 77 | u8g2_SetFontRefHeightText(u8g2_t *u8g2); 78 | u8g2_SetFontRefHeightExtendedText(u8g2_t *u8g2); 79 | u8g2_SetFontRefHeightAll(u8g2_t *u8g2); 80 | to change the top offset and the line height and 81 | u8log_SetLineHeightOffset(u8log_t *u8log, int8_t line_height_offset) 82 | to change the line height. 83 | 84 | */ 85 | void u8log_u8g2_cb(u8log_t * u8log) 86 | { 87 | u8g2_t *u8g2 = (u8g2_t *)(u8log->aux_data); 88 | if ( u8log->is_redraw_line || u8log->is_redraw_all ) 89 | { 90 | u8g2_FirstPage(u8g2); 91 | do 92 | { 93 | u8g2_DrawLog( u8g2, 0, u8g2_GetAscent(u8g2), u8log); 94 | } 95 | while( u8g2_NextPage(u8g2) ); 96 | } 97 | } 98 | 99 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8log_u8x8.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8log_u8x8.c 4 | 5 | 6 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 7 | 8 | Copyright (c) 2018, olikraus@gmail.com 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | * Redistributions of source code must retain the above copyright notice, this list 15 | of conditions and the following disclaimer. 16 | 17 | * Redistributions in binary form must reproduce the above copyright notice, this 18 | list of conditions and the following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 33 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | */ 36 | 37 | #include "u8x8.h" 38 | 39 | static void u8x8_DrawLogLine(u8x8_t *u8x8, uint8_t disp_x, uint8_t disp_y, uint8_t buf_y, u8log_t *u8log) U8X8_NOINLINE; 40 | static void u8x8_DrawLogLine(u8x8_t *u8x8, uint8_t disp_x, uint8_t disp_y, uint8_t buf_y, u8log_t *u8log) 41 | { 42 | uint8_t buf_x; 43 | uint8_t c; 44 | for( buf_x = 0; buf_x < u8log->width; buf_x++ ) 45 | { 46 | c = u8log->screen_buffer[buf_y * u8log->width + buf_x]; 47 | u8x8_DrawGlyph(u8x8, disp_x, disp_y, c); 48 | disp_x++; 49 | } 50 | } 51 | 52 | void u8x8_DrawLog(u8x8_t *u8x8, uint8_t x, uint8_t y, u8log_t *u8log) 53 | { 54 | uint8_t buf_y; 55 | for( buf_y = 0; buf_y < u8log->height; buf_y++ ) 56 | { 57 | u8x8_DrawLogLine(u8x8, x, y, buf_y, u8log); 58 | y++; 59 | } 60 | } 61 | 62 | 63 | void u8log_u8x8_cb(u8log_t * u8log) 64 | { 65 | u8x8_t *u8x8 = (u8x8_t *)(u8log->aux_data); 66 | if ( u8log->is_redraw_all ) 67 | { 68 | u8x8_DrawLog(u8x8, 0, 0, u8log); 69 | } 70 | else if ( u8log->is_redraw_line ) 71 | { 72 | u8x8_DrawLogLine(u8x8, 0, u8log->redraw_line, u8log->redraw_line, u8log); 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_d_stdio.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_d_stdio.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #include "u8x8.h" 37 | 38 | #include 39 | 40 | #define W 8 41 | #define H 2 42 | 43 | uint8_t bitmap[W * H * 8]; 44 | 45 | void bitmap_place_tile(uint8_t x, uint8_t y, uint8_t *tile) 46 | { 47 | uint8_t i; 48 | for (i = 0; i < 8; i++) 49 | bitmap[x * 8 + y * W * 8 + i] = tile[i]; 50 | } 51 | 52 | void bitmap_show(void) 53 | { 54 | int x, y; 55 | for (y = 0; y < H * 8; y++) 56 | { 57 | for (x = 0; x < W * 8; x++) 58 | { 59 | if ((bitmap[x + (y / 8) * W * 8] & (1 << ((y & 7)))) != 0) 60 | { 61 | printf("*"); 62 | } else 63 | { 64 | printf("."); 65 | } 66 | } 67 | printf("\n"); 68 | } 69 | } 70 | 71 | 72 | uint8_t u8x8_d_stdio(U8X8_UNUSED u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) 73 | { 74 | switch (msg) 75 | { 76 | case U8X8_MSG_DISPLAY_INIT: 77 | break; 78 | case U8X8_MSG_DISPLAY_SET_POWER_SAVE: 79 | if (arg_int == 0) 80 | bitmap_show(); 81 | break; 82 | case U8X8_MSG_DISPLAY_SET_CONTRAST: 83 | break; 84 | case U8X8_MSG_DISPLAY_DRAW_TILE: 85 | bitmap_place_tile(((u8x8_tile_t *) arg_ptr)->x_pos, ((u8x8_tile_t *) arg_ptr)->y_pos, 86 | ((u8x8_tile_t *) arg_ptr)->tile_ptr); 87 | break; 88 | default: 89 | break; 90 | } 91 | return 1; 92 | } 93 | 94 | 95 | void u8x8_SetupStdio(u8x8_t *u8x8) 96 | { 97 | u8x8_SetupDefaults(u8x8); 98 | u8x8->display_cb = u8x8_d_stdio; 99 | } 100 | 101 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_fonts.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/createskyblue/OpenT12/b0542867c2cfa123fc37ff1f54298928ea8ecdb0/lib/U8g2/src/clib/u8x8_fonts.c -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_gpio.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | 37 | #include "u8x8.h" 38 | 39 | 40 | void u8x8_gpio_call(u8x8_t *u8x8, uint8_t msg, uint8_t arg) 41 | { 42 | u8x8->gpio_and_delay_cb(u8x8, msg, arg, NULL); 43 | } 44 | 45 | /* 46 | void u8x8_gpio_Delay(u8x8_t *u8x8, uint8_t msg, uint8_t dly) 47 | { 48 | u8x8->gpio_and_delay_cb(u8x8, msg, dly, NULL); 49 | } 50 | */ -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_input_value.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_input_value.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #include "u8x8.h" 37 | 38 | /* 39 | return: 40 | 0: value is not changed (HOME/Break Button pressed) 41 | 1: value has been updated 42 | */ 43 | 44 | uint8_t u8x8_UserInterfaceInputValue(u8x8_t *u8x8, const char *title, const char *pre, uint8_t *value, uint8_t lo, uint8_t hi, uint8_t digits, const char *post) 45 | { 46 | uint8_t height; 47 | uint8_t y; 48 | uint8_t width; 49 | uint8_t x; 50 | uint8_t local_value = *value; 51 | uint8_t r; 52 | uint8_t event; 53 | 54 | /* calculate overall height of the input value box */ 55 | height = 1; /* button line */ 56 | height += u8x8_GetStringLineCnt(title); 57 | 58 | /* calculate offset from top */ 59 | y = 0; 60 | if ( height < u8x8_GetRows(u8x8) ) 61 | { 62 | y = u8x8_GetRows(u8x8); 63 | y -= height; 64 | y /= 2; 65 | } 66 | 67 | /* calculate offset from left for the label */ 68 | x = 0; 69 | width = u8x8_GetUTF8Len(u8x8, pre); 70 | width += digits; 71 | width += u8x8_GetUTF8Len(u8x8, post); 72 | if ( width < u8x8_GetCols(u8x8) ) 73 | { 74 | x = u8x8_GetCols(u8x8); 75 | x -= width; 76 | x /= 2; 77 | } 78 | 79 | /* render */ 80 | u8x8_ClearDisplay(u8x8); /* required, because not everything is filled */ 81 | u8x8_SetInverseFont(u8x8, 0); 82 | y += u8x8_DrawUTF8Lines(u8x8, 0, y, u8x8_GetCols(u8x8), title); 83 | x += u8x8_DrawUTF8(u8x8, x, y, pre); 84 | u8x8_DrawUTF8(u8x8, x+digits, y, post); 85 | u8x8_SetInverseFont(u8x8, 1); 86 | 87 | /* event loop */ 88 | u8x8_DrawUTF8(u8x8, x, y, u8x8_u8toa(local_value, digits)); 89 | for(;;) 90 | { 91 | event = u8x8_GetMenuEvent(u8x8); 92 | if ( event == U8X8_MSG_GPIO_MENU_SELECT ) 93 | { 94 | *value = local_value; 95 | r = 1; 96 | break; 97 | } 98 | else if ( event == U8X8_MSG_GPIO_MENU_HOME ) 99 | { 100 | r = 0; 101 | break; 102 | } 103 | else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_UP ) 104 | { 105 | if ( local_value >= hi ) 106 | local_value = lo; 107 | else 108 | local_value++; 109 | u8x8_DrawUTF8(u8x8, x, y, u8x8_u8toa(local_value, digits)); 110 | } 111 | else if ( event == U8X8_MSG_GPIO_MENU_PREV || event == U8X8_MSG_GPIO_MENU_DOWN ) 112 | { 113 | if ( local_value <= lo ) 114 | local_value = hi; 115 | else 116 | local_value--; 117 | u8x8_DrawUTF8(u8x8, x, y, u8x8_u8toa(local_value, digits)); 118 | } 119 | } 120 | 121 | u8x8_SetInverseFont(u8x8, 0); 122 | return r; 123 | } 124 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_message.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_message.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #include "u8x8.h" 37 | 38 | uint8_t u8x8_draw_button_line(u8x8_t *u8x8, uint8_t y, uint8_t w, uint8_t cursor, const char *s) 39 | { 40 | uint8_t i; 41 | uint8_t cnt; 42 | uint8_t total; 43 | uint8_t d; 44 | uint8_t x; 45 | cnt = u8x8_GetStringLineCnt(s); 46 | 47 | /* calculate the width of the button */ 48 | total = 0; 49 | for( i = 0; i < cnt; i++ ) 50 | { 51 | total += u8x8_GetUTF8Len(u8x8, u8x8_GetStringLineStart(i, s)); 52 | } 53 | total += (cnt-1); /* had one space between the buttons */ 54 | 55 | /* calculate the left offset */ 56 | d = 0; 57 | if ( total < w ) 58 | { 59 | d = w; 60 | d -= total; 61 | d /= 2; 62 | } 63 | 64 | /* draw the buttons */ 65 | x = d; 66 | u8x8_SetInverseFont(u8x8, 0); 67 | for( i = 0; i < cnt; i++ ) 68 | { 69 | if ( i == cursor ) 70 | u8x8_SetInverseFont(u8x8, 1); 71 | 72 | x+=u8x8_DrawUTF8(u8x8, x, y, u8x8_GetStringLineStart(i, s)); 73 | u8x8_SetInverseFont(u8x8, 0); 74 | x+=u8x8_DrawUTF8(u8x8, x, y, " "); 75 | } 76 | 77 | /* return the number of buttons */ 78 | return cnt; 79 | } 80 | 81 | /* 82 | title1: Multiple lines,separated by '\n' 83 | title2: A single line/string which is terminated by '\0' or '\n' . "title2" accepts the return value from u8x8_GetStringLineStart() 84 | title3: Multiple lines,separated by '\n' 85 | buttons: one more more buttons separated by '\n' and terminated with '\0' 86 | */ 87 | 88 | uint8_t u8x8_UserInterfaceMessage(u8x8_t *u8x8, const char *title1, const char *title2, const char *title3, const char *buttons) 89 | { 90 | uint8_t height; 91 | uint8_t y; 92 | uint8_t cursor = 0; 93 | uint8_t button_cnt; 94 | uint8_t event; 95 | 96 | u8x8_SetInverseFont(u8x8, 0); 97 | 98 | /* calculate overall height of the message box */ 99 | height = 1; /* button line */ 100 | height += u8x8_GetStringLineCnt(title1); 101 | if ( title2 != NULL ) 102 | height ++; 103 | height += u8x8_GetStringLineCnt(title3); 104 | 105 | /* calculate offset from top */ 106 | y = 0; 107 | if ( height < u8x8_GetRows(u8x8) ) 108 | { 109 | y = u8x8_GetRows(u8x8); 110 | y -= height; 111 | y /= 2; 112 | } 113 | 114 | /* draw message box */ 115 | 116 | u8x8_ClearDisplay(u8x8); /* required, because not everything is filled */ 117 | 118 | y += u8x8_DrawUTF8Lines(u8x8, 0, y, u8x8_GetCols(u8x8), title1); 119 | if ( title2 != NULL ) 120 | { 121 | u8x8_DrawUTF8Line(u8x8, 0, y, u8x8_GetCols(u8x8), title2); 122 | y++; 123 | } 124 | y += u8x8_DrawUTF8Lines(u8x8, 0, y, u8x8_GetCols(u8x8), title3); 125 | 126 | button_cnt = u8x8_draw_button_line(u8x8, y, u8x8_GetCols(u8x8), cursor, buttons); 127 | 128 | for(;;) 129 | { 130 | event = u8x8_GetMenuEvent(u8x8); 131 | if ( event == U8X8_MSG_GPIO_MENU_SELECT ) 132 | return cursor+1; 133 | else if ( event == U8X8_MSG_GPIO_MENU_HOME ) 134 | break; 135 | else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_UP ) 136 | { 137 | cursor++; 138 | if ( cursor >= button_cnt ) 139 | cursor = 0; 140 | u8x8_draw_button_line(u8x8, y, u8x8_GetCols(u8x8), cursor, buttons); 141 | } 142 | else if ( event == U8X8_MSG_GPIO_MENU_PREV || event == U8X8_MSG_GPIO_MENU_DOWN ) 143 | { 144 | if ( cursor == 0 ) 145 | cursor = button_cnt; 146 | cursor--; 147 | u8x8_draw_button_line(u8x8, y, u8x8_GetCols(u8x8), cursor, buttons); 148 | } 149 | } 150 | return 0; 151 | } 152 | 153 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_string.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_string.c 4 | 5 | string line procedures 6 | 7 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 8 | 9 | Copyright (c) 2016, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | */ 37 | 38 | #include "u8x8.h" 39 | 40 | uint8_t u8x8_GetStringLineCnt(const char *str) 41 | { 42 | char e; 43 | uint8_t line_cnt = 1; 44 | if ( str == NULL ) 45 | return 0; 46 | for(;;) 47 | { 48 | e = *str; 49 | if ( e == '\0' ) 50 | break; 51 | str++; 52 | if ( e == '\n' ) 53 | line_cnt++; 54 | } 55 | return line_cnt; 56 | } 57 | 58 | 59 | /* 60 | Assumes strings, separated by '\n' in "str". 61 | Returns the string at index "line_idx". First strng has line_idx = 0 62 | Example: 63 | Returns "xyz" for line_idx = 1 with str = "abc\nxyz" 64 | Support both UTF8 and normal strings. 65 | */ 66 | const char *u8x8_GetStringLineStart(uint8_t line_idx, const char *str ) 67 | { 68 | char e; 69 | uint8_t line_cnt = 1; 70 | 71 | if ( line_idx == 0 ) 72 | return str; 73 | 74 | for(;;) 75 | { 76 | e = *str; 77 | if ( e == '\0' ) 78 | break; 79 | str++; 80 | if ( e == '\n' ) 81 | { 82 | if ( line_cnt == line_idx ) 83 | return str; 84 | line_cnt++; 85 | } 86 | } 87 | return NULL; /* line not found */ 88 | } 89 | 90 | /* copy until first '\n' or '\0' in str */ 91 | /* Important: There is no string overflow check, ensure */ 92 | /* that the destination buffer is large enough */ 93 | void u8x8_CopyStringLine(char *dest, uint8_t line_idx, const char *str) 94 | { 95 | if ( dest == NULL ) 96 | return; 97 | str = u8x8_GetStringLineStart( line_idx, str ); 98 | if ( str != NULL ) 99 | { 100 | for(;;) 101 | { 102 | if ( *str == '\n' || *str == '\0' ) 103 | break; 104 | *dest = *str; 105 | dest++; 106 | str++; 107 | } 108 | } 109 | *dest = '\0'; 110 | } 111 | 112 | /* 113 | Draw a string 114 | Extend the string to size "w" 115 | Center the string within "w" 116 | return the size of the string 117 | 118 | */ 119 | uint8_t u8x8_DrawUTF8Line(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t w, const char *s) 120 | { 121 | uint8_t d, lw; 122 | uint8_t cx, dx; 123 | 124 | d = 0; 125 | 126 | lw = u8x8_GetUTF8Len(u8x8, s); 127 | if ( lw < w ) 128 | { 129 | d = w; 130 | d -=lw; 131 | d /= 2; 132 | } 133 | 134 | cx = x; 135 | dx = cx + d; 136 | while( cx < dx ) 137 | { 138 | u8x8_DrawUTF8(u8x8, cx, y, " "); 139 | cx++; 140 | } 141 | cx += u8x8_DrawUTF8(u8x8, cx, y, s); 142 | dx = x + w; 143 | while( cx < dx ) 144 | { 145 | u8x8_DrawUTF8(u8x8, cx, y, " "); 146 | cx++; 147 | } 148 | cx -= x; 149 | return cx; 150 | } 151 | 152 | /* 153 | draw several lines at position x,y. 154 | lines are stored in s and must be separated with '\n'. 155 | lines can be centered with respect to "w" 156 | if s == NULL nothing is drawn and 0 is returned 157 | returns the number of lines in s 158 | */ 159 | uint8_t u8x8_DrawUTF8Lines(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t w, const char *s) 160 | { 161 | uint8_t i; 162 | uint8_t cnt; 163 | cnt = u8x8_GetStringLineCnt(s); 164 | for( i = 0; i < cnt; i++ ) 165 | { 166 | u8x8_DrawUTF8Line(u8x8, x, y, w, u8x8_GetStringLineStart(i, s)); 167 | y++; 168 | } 169 | return cnt; 170 | } 171 | -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_u16toa.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_u16toa.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | 35 | */ 36 | 37 | 38 | #include "u8x8.h" 39 | 40 | const char *u8x8_u16toap(char * dest, uint16_t v) 41 | { 42 | uint8_t pos; 43 | uint8_t d; 44 | uint16_t c; 45 | c = 10000; 46 | for( pos = 0; pos < 5; pos++ ) 47 | { 48 | d = '0'; 49 | while( v >= c ) 50 | { 51 | v -= c; 52 | d++; 53 | } 54 | dest[pos] = d; 55 | c /= 10; 56 | } 57 | dest[5] = '\0'; 58 | return dest; 59 | } 60 | 61 | /* v = value, d = number of digits */ 62 | const char *u8x8_u16toa(uint16_t v, uint8_t d) 63 | { 64 | static char buf[6]; 65 | d = 5-d; 66 | return u8x8_u16toap(buf, v) + d; 67 | } 68 | 69 | const char *u8x8_utoa(uint16_t v) 70 | { 71 | const char *s = u8x8_u16toa(v, 5); 72 | while( *s == '0' ) 73 | s++; 74 | if ( *s == '\0' ) 75 | s--; 76 | return s; 77 | } -------------------------------------------------------------------------------- /lib/U8g2/src/clib/u8x8_u8toa.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8x8_u8toa.c 4 | 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) 6 | 7 | Copyright (c) 2016, olikraus@gmail.com 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without modification, 11 | are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, this list 14 | of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright notice, this 17 | list of conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | 37 | #include "u8x8.h" 38 | 39 | static const unsigned char u8x8_u8toa_tab[3] = { 100, 10, 1 } ; 40 | const char *u8x8_u8toap(char * dest, uint8_t v) 41 | { 42 | uint8_t pos; 43 | uint8_t d; 44 | uint8_t c; 45 | for( pos = 0; pos < 3; pos++ ) 46 | { 47 | d = '0'; 48 | c = *(u8x8_u8toa_tab+pos); 49 | while( v >= c ) 50 | { 51 | v -= c; 52 | d++; 53 | } 54 | dest[pos] = d; 55 | } 56 | dest[3] = '\0'; 57 | return dest; 58 | } 59 | 60 | /* v = value, d = number of digits */ 61 | const char *u8x8_u8toa(uint8_t v, uint8_t d) 62 | { 63 | static char buf[4]; 64 | d = 3-d; 65 | return u8x8_u8toap(buf, v) + d; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:pico32] 12 | platform = espressif32@3.5.0 13 | board = pico32 14 | framework = arduino 15 | 16 | upload_speed = 921600 17 | build_flags = -DCORE_DEBUG_LEVEL=5 18 | board_build.partitions = min_spiffs.csv 19 | monitor_speed = 115200 20 | monitor_filters = esp32_exception_decoder, default -------------------------------------------------------------------------------- /src/BLE.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenT12.h" 2 | char BLE_name[20] = "OPEN-T12"; 3 | uint8_t BLE_State = true; 4 | 5 | void BLE_Init(void) { 6 | 7 | if (!BLE_State) return; 8 | 9 | SerialBT.begin(BLE_name); 10 | } 11 | 12 | void BLE_Restart(void){ 13 | SerialBT.end(); 14 | BLE_Init(); 15 | } 16 | 17 | void BLE_Rename(void) { 18 | TextEditor("蓝牙设备名", BLE_name); 19 | BLE_Restart(); 20 | } -------------------------------------------------------------------------------- /src/Bezier.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenT12.h" 2 | 3 | //https://github.com/ArduboyCollection/arduboy-moire 4 | 5 | const int screenWidth = 128; 6 | const int screenHeight = 64; 7 | 8 | const int numberOfLines = 20; 9 | 10 | const int maxSpeed = 6; 11 | 12 | /* 13 | * structs that describe the scene 14 | */ 15 | 16 | struct Point { 17 | int x; 18 | int y; 19 | }; 20 | 21 | struct Velocity { 22 | int dx; 23 | int dy; 24 | }; 25 | 26 | struct End { 27 | Point p; 28 | Velocity v; 29 | }; 30 | 31 | struct Line { 32 | End e0; 33 | End e1; 34 | }; 35 | 36 | struct Scene { 37 | Line lines[numberOfLines]; 38 | int indexOfHeadLine = numberOfLines - 1; 39 | }; 40 | 41 | /* 42 | * scene initialization 43 | */ 44 | 45 | static Point randomPoint() { 46 | return { random(screenWidth), random(screenHeight) }; 47 | } 48 | 49 | static int randomSpeed() { 50 | return random(1, maxSpeed); 51 | } 52 | 53 | static Velocity randomVelocity() { 54 | return { randomSpeed(), randomSpeed() }; 55 | } 56 | 57 | static End randomEnd() { 58 | return { randomPoint(), randomVelocity() }; 59 | } 60 | 61 | static Line randomLine() { 62 | return { randomEnd(), randomEnd() }; 63 | } 64 | 65 | static Point PointZero = { 0, 0 }; 66 | static Velocity VelocityZero = { 0, 0 }; 67 | static End EndZero = { PointZero, VelocityZero }; 68 | static Line LineZero = { EndZero, EndZero }; 69 | 70 | 71 | /* 72 | * functions to advance basic value types 73 | */ 74 | static End endByAdvancingEnd(End en) { 75 | 76 | int ndx = en.v.dx; 77 | int ndy = en.v.dy; 78 | 79 | int nx = en.p.x + ndx; 80 | int ny = en.p.y + ndy; 81 | 82 | if (nx < 0 || nx > screenWidth) { 83 | ndx = -1 * sign(ndx) * randomSpeed(); 84 | nx = en.p.x + ndx; 85 | } 86 | if (ny < 0 || ny > screenHeight) { 87 | ndy = -1 * sign(ndy) * randomSpeed(); 88 | ny = en.p.y + ndy; 89 | } 90 | 91 | return { 92 | { nx, ny }, 93 | { ndx, ndy } 94 | }; 95 | } 96 | 97 | static Line lineByAdvancingLine(Line line) { 98 | return { 99 | endByAdvancingEnd(line.e0), 100 | endByAdvancingEnd(line.e1) 101 | }; 102 | } 103 | 104 | /* 105 | * functions to operate on pointer to scene 106 | */ 107 | 108 | static void sceneInit(Scene* scene) { 109 | for (int i = 0; i < numberOfLines; i++) { 110 | scene->lines[i] = LineZero; 111 | } 112 | scene->lines[scene->indexOfHeadLine] = randomLine(); 113 | } 114 | 115 | static Line* sceneLine(Scene* scene, int index) { 116 | int j = (scene->indexOfHeadLine + 1 + index) % numberOfLines; 117 | return &(scene->lines[j]); 118 | } 119 | 120 | static void sceneAdvance(Scene* scene) { 121 | Line head = scene->lines[scene->indexOfHeadLine]; 122 | Line nextHead = lineByAdvancingLine(head); 123 | scene->indexOfHeadLine = (scene->indexOfHeadLine + 1) % numberOfLines; 124 | scene->lines[scene->indexOfHeadLine] = nextHead; 125 | } 126 | 127 | 128 | static void drawLine(Line* line, uint16_t color) { 129 | Disp.drawLine(line->e0.p.x, line->e0.p.y, line->e1.p.x, line->e1.p.y); 130 | } 131 | 132 | 133 | void RunSleepLoop(void) { 134 | static Scene scene; 135 | 136 | static bool SleepScreenInit = false; 137 | if (!SleepScreenInit) { 138 | sceneInit(&scene); 139 | SleepScreenInit = true; 140 | } 141 | 142 | if (!SleepEvent) return; 143 | 144 | Line* tail = sceneLine(&scene, 0); 145 | drawLine(tail, 0); 146 | sceneAdvance(&scene); 147 | for (int i = 0; i < numberOfLines; i++) { 148 | Line* line = sceneLine(&scene, i); 149 | drawLine(line, 1); 150 | } 151 | } 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /src/MathFun.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenT12.h" 2 | // extern U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI Disp; 3 | // extern U8G2_ST7920_128X64_F_SW_SPI Disp; 4 | /* 5 | @作用 获取数值某一位 6 | @传入 数值 指定位数 7 | @传出 数值指定位数的十进制值 8 | */ 9 | int get_Dec_Bit(int x, int n) 10 | { 11 | return (int)(x / pow(10.0, n)) % 10; 12 | } 13 | 14 | /* 15 | @作用 获取数值长度 16 | @传入 数值 17 | @传出 数值长度 18 | */ 19 | int Get_Dec_Deep(int x) 20 | { 21 | int i = 0; 22 | do { 23 | i++; 24 | x /= 10; 25 | } while (x != 0); 26 | return i; 27 | } 28 | 29 | /* 30 | @作用 获取数字每一位的和 31 | @传入 数字 32 | @输出 数字每一位的和 33 | */ 34 | int Get_Int_Bit_Sum(int x) 35 | { 36 | int sum = 0; 37 | for (int i = 0; i < Get_Dec_Deep(x); i++) 38 | sum += get_Dec_Bit(x, i); 39 | return sum; 40 | } 41 | 42 | 43 | void GetUtf8Length(char const* str, int* cnt) { 44 | while (*str != '\0') { 45 | if (*str & 1 << 7) {/* 第8位(从右到左)为1*/ 46 | if (*str & (1 << 6)) {/*第7位为1*/ 47 | if (*str & (1 << 5)) {/*第6位为1*/ 48 | if (*str & (1 << 4)) {/*第5位为1 11110xxx*/ 49 | cnt[4]++, cnt[0]++, str += 4;/*4字节的字符总数加1,各种长度总数加1,指针向后移动4位*/ 50 | continue;/*开始下次循环*/ 51 | } 52 | 53 | cnt[3]++, cnt[0]++, str += 3;/* 1110xxxx*/ 54 | continue; 55 | 56 | } 57 | 58 | cnt[2]++, cnt[0]++, str += 2;/*110xxxxx*/ 59 | continue; 60 | 61 | } 62 | } 63 | cnt[1]++, cnt[0]++, str += 1;/*0xxxxxxx*/ 64 | continue; 65 | } 66 | } 67 | 68 | uint32_t Get_UTF8_Ascii_Pix_Len(uint8_t size, const char* s) { 69 | return Disp.getUTF8Width(s); 70 | } 71 | 72 | /* 73 | @作用 UTF8混合字符串计算水平居中 74 | @输入:UTF8字符串 75 | @输出:居中位置 76 | */ 77 | uint32_t UTF8_HMiddle(uint32_t x, uint32_t w, uint8_t size, const char* s) { 78 | return x + ( w - Get_UTF8_Ascii_Pix_Len(size,s)) / 2; 79 | } 80 | 81 | //串口打印内存 82 | void ShowBuffer(uint8_t* buffer, uint32_t size) { 83 | uint8_t AsciiBuffer[17]; 84 | uint32_t OutputSize = 0; 85 | for (uint32_t i = 0;i < size;i++) { 86 | if (i % 16 == 0) { 87 | memcpy(AsciiBuffer, buffer + i, 16); 88 | AsciiBuffer[16] = '\0'; 89 | printf("\n0X%08X | ", i + &(*buffer)); 90 | for (uint8_t j = 0;j < 16;j++) { 91 | OutputSize++; 92 | if (OutputSize > size) break; 93 | printf("%02X ", buffer[i + j]); 94 | } 95 | 96 | printf("| %s", AsciiBuffer); 97 | } 98 | } 99 | printf("\n\n\n%s", buffer); 100 | } 101 | 102 | 103 | /** 104 | *卡尔曼滤波器 105 | *@param KFP *kfp 卡尔曼结构体参数 106 | * float input 需要滤波的参数的测量值(即传感器的采集值) 107 | *@return 滤波后的参数(最优值) 108 | */ 109 | float kalmanFilter(KFP *kfp,float input) 110 | { 111 | //预测协方差方程:k时刻系统估算协方差 = k-1时刻的系统协方差 + 过程噪声协方差 112 | kfp->Now_P = kfp->LastP + kfp->Q; 113 | //卡尔曼增益方程:卡尔曼增益 = k时刻系统估算协方差 / (k时刻系统估算协方差 + 观测噪声协方差) 114 | kfp->Kg = kfp->Now_P / (kfp->Now_P + kfp->R); 115 | //更新最优值方程:k时刻状态变量的最优值 = 状态变量的预测值 + 卡尔曼增益 * (测量值 - 状态变量的预测值) 116 | kfp->out = kfp->out + kfp->Kg * (input -kfp->out);//因为这一次的预测值就是上一次的输出值 117 | //更新协方差方程: 本次的系统协方差付给 kfp->LastP 威下一次运算准备。 118 | kfp->LastP = (1-kfp->Kg) * kfp->Now_P; 119 | return kfp->out; 120 | } 121 | 122 | /*** 123 | * @description: 把ESP32的原生ADC采样数据通过经验公式转换为电压 124 | * @param {uint16_t} adc 125 | * @return 电压(单位:V) 126 | */ 127 | #define ADC1_MinVol 0.128 128 | #define ADC1_MaxVol 3.11 129 | double ESP32_ADC2Vol(uint16_t adc) { 130 | //return ((adc / 4095.0) * (ADC1_MaxVol - ADC1_MinVol)) + ADC1_MinVol; 131 | return (adc / 4095.0) * 3.3; 132 | } 133 | 134 | /*** 135 | * @description: 分钟转毫秒 136 | * @param {uint32_t} min 137 | * @return {*} 138 | */ 139 | uint32_t Minute2Millis(float min) { 140 | return min * 60 * 1000; 141 | } 142 | /*** 143 | * @description: 判断符号正负 144 | * @param {int} x 145 | * @return {*} 146 | */ 147 | int sign(int x) { 148 | return (x > 0) - (x < 0); 149 | } -------------------------------------------------------------------------------- /src/TODO.md: -------------------------------------------------------------------------------- 1 | # 待做清单 TODO LIST 2 | 3 | - [ ] 增加黄色的氛围指示灯:PCB去掉覆铜,把灯贴在背面 4 | - [ ] 尝试使用外置ADC芯片 HX711 5 | - [ ] wav音效采样 6 | - [x] 文件系统 7 | - [x] 增加PID调节 8 | - [x] 开机密码 9 | - [x] 独立输入控件 10 | - [x] 检测到烙铁头拔出插入后弹出选择配置的菜单 11 | - [x] 声效 12 | - [ ] 多种界面选择 13 | - [ ] ADC:从原始数值转为获取电压值(mv) 14 | - [ ] 加入K热偶自校准电路 15 | - [x] 手柄睡眠\触发代码 16 | - [x] 主界面双击快捷键弹出PID快速调整菜单 17 | - [x] 蓝牙设置菜单 18 | - [ ] 蓝牙混沌加密实验 19 | - [ ] 预留一个串口给语音模块 20 | 21 | ## 评论区建议 22 | 23 | - [大哥大姐行行好昂]推荐adc ads1115/1117 ad7705 都有arduino库,16位,支持500hz以上采样频率[doge] 711的采样太慢了,数据严重滞后[doge] 24 | 25 | - [宝宝不开心qwq]既然都用esp32了那蓝牙或者WiFi一定要启用了[滑稽],通过蓝牙或者WiFi设置温度曲线应该不错吧,还有交互图标要是也能实现WiFi设置也就更好了 26 | 27 | - [寻寻40209995151]up你好,我能提几个建议吗? 28 | - 1·尽量减少外围元件,使用相同型号的电阻电容,可以降低成本,每种元件都买20个就浪费了。 29 | - 2·使用DC -DC电路进行降压,降低发热和电源损耗。 30 | - 3·如果依旧使用LDO,将滤波电容换成钽电容。 31 | - 4·将led指示灯换成3色的led(红绿蓝),分别用3色和闪烁表示不同的状态,比如绿色表示正常恒温,蓝色表示休眠,红色表示升温。 32 | - 5·添加一个按键用于快捷操作。 33 | - 6·将oled的外围电路直接放到电路板上,只需购买裸屏,外表也不会因排针的存在不美观。 34 | - 最后祝up少掉几根头发。[doge] 35 | -------------------------------------------------------------------------------- /src/TipManager.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenT12.h" 2 | 3 | uint8_t TipID = 0; 4 | uint8_t TipTotal = 1; 5 | 6 | TIPCONFIG MyTip[MaxTipConfig] = { 7 | {{TempP1,TempP2,TempP3,TempP4},{{30.0,0,0.5},{20.0,0,0.5}},"深圳K-1"}, 8 | }; 9 | 10 | /*** 11 | * @description: 载入烙铁头配置到系统环境 12 | * @param {*} 13 | * @return {*} 14 | */ 15 | void LoadTipConfig(void) { 16 | //载入温度系数 17 | for (uint8_t i=0;i<4;i++) { 18 | PTemp[i] = MyTip[TipID].PTemp[i]; 19 | } 20 | //载入PID参数 21 | aggKp = MyTip[TipID].PID[0][0]; 22 | aggKi = MyTip[TipID].PID[0][1]; 23 | aggKd = MyTip[TipID].PID[0][2]; 24 | 25 | consKp = MyTip[TipID].PID[1][0]; 26 | consKi = MyTip[TipID].PID[1][1]; 27 | consKd = MyTip[TipID].PID[1][2]; 28 | //载入名称 29 | TipName = MyTip[TipID].name; 30 | 31 | } 32 | 33 | /*** 34 | * @description: 保存烙铁头配置到系统环境 35 | * @param {*} 36 | * @return {*} 37 | */ 38 | void SaveTipConfig(void) { 39 | //保存温度系数 40 | for (uint8_t i = 0;i < 4;i++) { 41 | MyTip[TipID].PTemp[i] = PTemp[i]; 42 | } 43 | //保存PID参数 44 | MyTip[TipID].PID[0][0] = aggKp; 45 | MyTip[TipID].PID[0][1] = aggKi; 46 | MyTip[TipID].PID[0][2] = aggKd; 47 | 48 | MyTip[TipID].PID[1][0] = consKp; 49 | MyTip[TipID].PID[1][1] = consKi; 50 | MyTip[TipID].PID[1][2] = consKd; 51 | 52 | //由于名称是用指针传递,所以不需要重新赋值 53 | } 54 | 55 | /*** 56 | * @description: 更新菜单配置列表 57 | * @param {*} 58 | * @return {*} 59 | */ 60 | void FlashTipMenu(void){ 61 | uint8_t MLID = Get_Real_Menu_Level_Id(15); //查询配置列表所在的菜单系统层级 62 | uint8_t MID; 63 | 64 | MenuLevel[MLID].max = TipTotal; //修改菜单最大项目数量 65 | 66 | for (uint8_t i=0;i 1) { 124 | //覆盖并移动配置 125 | for (uint8_t i=TipID;i