数码之家

 找回密码
 立即注册
搜索
查看: 1518|回复: 19

[工仪] 关于OpenLog 使用问题求教(制作GPS轨迹记录仪)

[复制链接]
发表于 2022-8-15 15:38:07 | 显示全部楼层 |阅读模式
100家元
最近在做一个徒步轨迹记录器,之前用windows手机,有个小软件记录,可以关屏,也相对省电。现在的安卓手机,体积又大,又费电(记录时得一直亮着屏幕,一灭屏软件就不记录了,或者要开地图软件在后台运行),反正很不爽,于是就自己搞了一个小盒子出门带身上,用内存卡记录gps数据,回头复制到电脑上查看存档。东西基本完工,但调试过程中多次通电,导致OpenLog 文件编号从001到2065了,强迫症表示很难受,想让它回到001.TXT,看了半天说明文件,鸟文翻译着看,大概看懂了它是有命令模式可以输入特定的命令实现基本的文件操作以及改变设置参数。但说明文件里没看到具体用哪些命令实现这些功能,有在用这个模块的前辈指导一下,怎么把文件名回归到001,谢谢!

微信截图_20220815153710.png
OpenLog是一个开源工程,产品介绍:https://learn.sparkfun.com/tutorials/openlog-hookup-guide
微信图片_20220815152241.jpg
微信图片_20220815152244.jpg

微信截图_20220815151708.png







最佳答案

查看完整内容

然后看代码中 这个“4”好像也是重置为新系统配置的!
发表于 2022-8-15 15:38:08 | 显示全部楼层

然后看代码中 这个“4”好像也是重置为新系统配置的!
回复

使用道具 举报

发表于 2022-8-15 19:53:47 | 显示全部楼层
set 命令的一个参数可以重置序号

001.png

打赏

参与人数 1家元 +20 收起 理由
zhkrid + 20

查看全部打赏

回复

使用道具 举报

发表于 2022-8-15 23:55:39 | 显示全部楼层
gsm1161 发表于 2022-8-15 19:53
set 命令的一个参数可以重置序号

确实有这个功能模式。那么问题是如何让模块进入到这个模式??

论坛助手,iPhone
回复

使用道具 举报

发表于 2022-8-16 00:28:20 | 显示全部楼层
不懂  顶一下
回复

使用道具 举报

发表于 2022-8-16 06:46:41 | 显示全部楼层
小米手环  或者运动app都有这个功能吧  
回复

使用道具 举报

发表于 2022-8-16 07:51:54 | 显示全部楼层
image.png
这里好像告诉你了需要在config.txt操作
image.png
image.png
第四个数字改成2就是Command Mode.模式,然后断电重启,就可以通过串口发送命令了!
image.png
其实看不懂英文,仔细看也大约能看懂,详细的用翻译软件翻译一下就行了!
回复

使用道具 举报

 楼主| 发表于 2022-8-16 09:19:50 | 显示全部楼层
myseil 发表于 2022-8-16 07:51
这里好像告诉你了需要在config.txt操作

我要的命令代码,
回复

使用道具 举报

发表于 2022-8-16 09:20:42 | 显示全部楼层
还是双电池的
回复

使用道具 举报

发表于 2022-8-16 09:33:25 | 显示全部楼层
感觉很有趣的东西,不过又觉得用不上啊,GPS模块加单片机不就搞定了,GPS模块明码输出,单片机写一下TF卡
回复

使用道具 举报

发表于 2022-8-16 09:56:38 | 显示全部楼层
zhkrid 发表于 2022-8-16 09:19
我要的命令代码,

https://github.com/sparkfun/OpenLog/wiki/Command-Set
这里有个说明。然后这里也有一个说如何重置编号,你可以试试!
https://github.com/sparkfun/Open ... uecomment-133188145
image.png
回复

使用道具 举报

发表于 2022-8-16 09:58:21 | 显示全部楼层
华为手表可以记录运动轨迹,速度也能记录,买个成品功能完善。
回复

使用道具 举报

发表于 2022-8-16 10:08:47 | 显示全部楼层
image.png
新版中好像设置是“5”
  1. //Change how OpenLog works
  2. //1) New File Mode: Turn on unit, unit will create new file, and just start logging
  3. //2) Append File Mode: Turn on, append to known file, and just start logging
  4. //3) Command Mode: Turn on, sit at command prompt
  5. //4) Rotate Mode: Turn on, append data to current log file until it becomes to big,
  6. //    then move on to next, rotating to overwrite first one after max file count has been reached
  7. //5) Resets the newLog file number to zero
  8. //6) Change the escape charater
  9. //7) Change number of escape characters needed to enter command mode
  10. //8) Change max file size for rotate mode in MB
  11. //9) Change max number of files in rotate mode
  12. void systemMenu(void)
  13. {
  14.   byte systemMode = EEPROM.read(LOCATION_SYSTEM_SETTING);

  15.   while (1)
  16.   {
  17.     NewSerial.println(F("\r\nSystem Configuration"));

  18.     NewSerial.print(F("Current boot mode: "));
  19.     if (systemMode == MODE_NEWLOG) NewSerial.print(F("New file"));
  20.     if (systemMode == MODE_SEQLOG) NewSerial.print(F("Append file"));
  21.     if (systemMode == MODE_COMMAND) NewSerial.print(F("Command"));
  22.     if (systemMode == MODE_ROTATE) NewSerial.print(F("Rotate"));
  23.     NewSerial.println();

  24.     NewSerial.print(F("Current escape character and amount: "));
  25.     NewSerial.print(setting_escape_character, DEC);
  26.     NewSerial.print(F(" x "));
  27.     NewSerial.println(setting_max_escape_character, DEC);

  28.     NewSerial.print(F("Rotate mode max file size (MB) and max file count: "));
  29.     NewSerial.print(setting_max_filesize_MB, DEC);
  30.     NewSerial.print(F(", "));
  31.     NewSerial.println(setting_max_filenumber, DEC);

  32.     NewSerial.println(F("Change:"));
  33.     NewSerial.println(F("1) Mode to new file logging"));
  34.     NewSerial.println(F("2) Mode to append file logging"));
  35.     NewSerial.println(F("3) Mode to command prompt"));
  36.     NewSerial.println(F("4) Mode to rotate logging"));
  37.     NewSerial.println(F("5) Reset new file number"));
  38.     NewSerial.println(F("6) Escape character"));
  39.     NewSerial.println(F("7) Number of escape characters"));
  40.     NewSerial.println(F("8) Max file size (MB) in rotate mode"));
  41.     NewSerial.println(F("9) Max file number in rotate mode"));

  42. #if DEBUG
  43.     NewSerial.println(F("a) Clear all user settings"));
  44. #endif

  45.     NewSerial.println(F("x) Exit"));
  46.     //Print prompt
  47.     NewSerial.print(F(">"));

  48.     //Read command
  49.     while (!NewSerial.available());
  50.     char command = NewSerial.read();

  51.     //Execute command
  52.     if (command == '1')
  53.     {
  54.       NewSerial.println(F("New file logging"));
  55.       EEPROM.write(LOCATION_SYSTEM_SETTING, MODE_NEWLOG);
  56.       recordConfigFile(); //Put this new setting into the config file
  57.       return;
  58.     }
  59.     if (command == '2')
  60.     {
  61.       NewSerial.println(F("Append file logging"));
  62.       EEPROM.write(LOCATION_SYSTEM_SETTING, MODE_SEQLOG);
  63.       recordConfigFile(); //Put this new setting into the config file
  64.       return;
  65.     }
  66.     if (command == '3')
  67.     {
  68.       NewSerial.println(F("Command prompt"));
  69.       EEPROM.write(LOCATION_SYSTEM_SETTING, MODE_COMMAND);
  70.       recordConfigFile(); //Put this new setting into the config file
  71.       return;
  72.     }
  73.     if (command == '4')
  74.     {
  75.       NewSerial.println(F("Rotate logging"));
  76.       EEPROM.write(LOCATION_SYSTEM_SETTING, MODE_ROTATE);
  77.       recordConfigFile(); //Put this new setting into the config file
  78.       return;
  79.     }
  80.     if (command == '5')
  81.     {
  82.       NewSerial.println(F("New file number reset to zero"));
  83.       EEPROM.write(LOCATION_FILE_NUMBER_LSB, 0);
  84.       EEPROM.write(LOCATION_FILE_NUMBER_MSB, 0);

  85.       //65533 log testing
  86.       //EEPROM_write(LOCATION_FILE_NUMBER_LSB, 0xFD);
  87.       //EEPROM_write(LOCATION_FILE_NUMBER_MSB, 0xFF);
  88.       return;
  89.     }
  90.     if (command == '6')
  91.     {
  92.       NewSerial.print(F("Enter a new escape character: "));

  93.       while (!NewSerial.available()); //Wait for user to hit character
  94.       setting_escape_character = NewSerial.read();

  95.       EEPROM.write(LOCATION_ESCAPE_CHAR, setting_escape_character);
  96.       recordConfigFile(); //Put this new setting into the config file

  97.       NewSerial.print(F("\n\rNew escape character: "));
  98.       NewSerial.println(setting_escape_character, DEC);
  99.       return;
  100.     }
  101.     if (command == '7')
  102.     {
  103.       NewSerial.print(F("\n\rEnter number of escape characters to look for (0 to 255): "));
  104.       int choice = getSerialByte();
  105.       if (choice >= 0)
  106.       {
  107.         setting_max_escape_character = (byte)choice;
  108.         EEPROM.write(LOCATION_MAX_ESCAPE_CHAR, setting_max_escape_character);
  109.         recordConfigFile(); //Put this new setting into the config file
  110.       }

  111.       NewSerial.print(F("\n\rNumber of escape characters needed: "));
  112.       NewSerial.println(setting_max_escape_character, DEC);
  113.       return;
  114.     }
  115.     if (command == '8')
  116.     {
  117.       NewSerial.print(F("\n\rEnter max size of log files in MB (0 to 254): "));
  118.       int choice = getSerialByte();
  119.       if (choice >= 0)
  120.       {
  121.         setting_max_filesize_MB = choice;
  122.         EEPROM.write(LOCATION_MAX_FILESIZE_MB, setting_max_filesize_MB);
  123.         recordConfigFile(); //Put this new setting into the config file
  124.       }
  125.       NewSerial.print(F("\n\rMax log file size in rotate mode now (MB): "));
  126.       NewSerial.println(setting_max_filesize_MB, DEC);
  127.       return;
  128.     }
  129.     if (command == '9')
  130.     {
  131.       NewSerial.print(F("\n\rEnter maximum log file number in rotate mode (0 to 255): "));
  132.       int choice = getSerialByte();
  133.       if (choice >= 0)
  134.       {
  135.         setting_max_filenumber = choice;
  136.         EEPROM.write(LOCATION_MAX_FILENUMBER, setting_max_filenumber);
  137.         recordConfigFile(); //Put this new setting into the config file
  138.       }
  139.       NewSerial.print(F("\n\rMaximum filenumber in rotate mode: "));
  140.       NewSerial.println(setting_max_filenumber, DEC);
  141.       return;
  142.     }
  143. #if DEBUG
  144.     //This allows us to reset the EEPROM and config file on a unit to see what would happen to an
  145.     //older unit that is upgraded/reflashed to newest firmware
  146.     if (command == 'a')
  147.     {
  148.       //EEPROM.write(LOCATION_BAUD_SETTING, 0xFF);
  149.       EEPROM.write(LOCATION_SYSTEM_SETTING, 0xFF);
  150.       EEPROM.write(LOCATION_FILE_NUMBER_LSB, 0xFF);
  151.       EEPROM.write(LOCATION_FILE_NUMBER_MSB, 0xFF);
  152.       EEPROM.write(LOCATION_ESCAPE_CHAR, 0xFF);
  153.       EEPROM.write(LOCATION_MAX_ESCAPE_CHAR, 0xFF);
  154.       EEPROM.write(LOCATION_MAX_FILESIZE_MB, 0xFF);
  155.       EEPROM.write(LOCATION_MAX_FILENUMBER, 0xFF);

  156.       //Remove the config file if it is there
  157.       SdFile myFile;
  158.       if (!sd.chdir()) systemError(ERROR_ROOT_INIT); // open the root directory

  159.       char configFileName[strlen(CFG_FILENAME) + 1];
  160.       strcpy_P(configFileName, PSTR(CFG_FILENAME)); //This is the name of the config file. 'config.sys' is probably a bad idea.

  161.       //If there is currently a config file, trash it
  162.       if (myFile.open(configFileName, O_WRITE)) {
  163.         if (!myFile.remove()) {
  164.           NewSerial.println(F("Remove config failed"));
  165.           myFile.close(); //Close this file
  166.           return;
  167.         }
  168.       }

  169.       NewSerial.println(F("Unit has been reset. Please power cycle"));
  170.       while (1);
  171.     }
  172. #endif

  173.     if (command == 'x')
  174.     {
  175.       //Do nothing, just exit
  176.       NewSerial.println(F("Exiting"));
  177.       return;
  178.     }
  179.   }
  180. }
复制代码


image.png
回复

使用道具 举报

 楼主| 发表于 2022-8-16 11:52:19 | 显示全部楼层
babybug 发表于 2022-8-16 09:33
感觉很有趣的东西,不过又觉得用不上啊,GPS模块加单片机不就搞定了,GPS模块明码输出,单片机写一下TF卡 ...

这个模块就是个单片机,串口接收数据,写tf卡,我不会这么高端的编程,只能买成品模块用了
回复

使用道具 举报

 楼主| 发表于 2022-8-16 11:59:48 | 显示全部楼层
本帖最后由 zhkrid 于 2022-8-16 12:20 编辑
myseil 发表于 2022-8-16 10:08
新版中好像设置是“5”

发送5给模块,模块有回应,4也试过了
但文件编号还是没回到001

微信截图_20220816120115.png
回复

使用道具 举报

发表于 2022-8-16 15:10:44 | 显示全部楼层
zhkrid 发表于 2022-8-16 11:59
发送5给模块,模块有回应,4也试过了
但文件编号还是没回到001

image.png
串口有没有回显 “System Configuration”  要回显这个才能设置!
然后设置完成后  是下次上电生效
回复

使用道具 举报

 楼主| 发表于 2022-8-16 19:31:01 | 显示全部楼层
myseil 发表于 2022-8-16 15:10
串口有没有回显 “System Configuration”  要回显这个才能设置!
然后设置完成后  是下次上电生效
...

搞定了,又仔细看了一下说明文档,数字4是二级命令,要先执行"set"命令,然后再执行“4”命令。

先用“?”调出帮助文档,里面有命令清单
微信截图_20220816185748.png
微信截图_20220816185648.png
微信截图_20220816185528.png
回复

使用道具 举报

发表于 2022-8-16 20:30:13 | 显示全部楼层
zhkrid 发表于 2022-8-16 19:31
搞定了,又仔细看了一下说明文档,数字4是二级命令,要先执行"set"命令,然后再执行“4”命令。

先用“? ...

和很多boot一样的 在引导里面修改的!  可以了就行了,鸟语实在是难懂!
回复

使用道具 举报

 楼主| 发表于 2022-8-16 22:58:40 来自手机浏览器 | 显示全部楼层
lcl2094 发表于 2022-8-16 09:58
华为手表可以记录运动轨迹,速度也能记录,买个成品功能完善。

我可以说买不起吗,我这个直接成本就这个记录模块,gps模块拆机的,天线自己调的,外壳和pcb是jlc免费撸的,剩下一点阻容感大部分也是拆机,然后红包撸了一点
回复

使用道具 举报

发表于 2022-8-17 09:51:06 | 显示全部楼层
jlc还能免费3D打印啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

APP|手机版|小黑屋|关于我们|联系我们|法律条款|技术知识分享平台

闽公网安备35020502000485号

闽ICP备2021002735号-2

GMT+8, 2024-5-3 10:05 , Processed in 0.124801 second(s), 12 queries , Redis On.

Powered by Discuz!

© 2006-2023 smzj.net

快速回复 返回顶部 返回列表