Forum Posts

yannick.wiegers
Dec 12, 2019
In Configuration Support
Hello, for the purpose of my study I need to have the AudioMoths start at a specific date a couple of days after I place them. I understand that this will be implemented in a future update, but unfortunately I do not have the time to wait for that one. I'm therefore trying to hardcode the starting date into the firmware. I'm currently trying to make it so that when the default switch is triggered it will wait for the set date and then start recording. However, it just starts recording normally. I suspect it has something to do with the configured start date of the recorder (1970) but I'm not sure. If someone would point out where my code is going wrong I would greatly appreciate it! PS: when I try to flash the firmware it always crashes once, then I have to restart it in boot mode, after which it does work. Is there a fix for this? Here is my piece of code: if (switchPosition != *previousSwitchPosition) { if (switchPosition == AM_SWITCH_DEFAULT) { time_t current_time; struct tm * timeinfo; /* These are the values of my planned recording time */ int target_year = 2019, target_month = 12, target_day = 12; int target_hour = 14, target_minute = 50, target_second = 0; /* Get the current time */ time ( &current_time ); timeinfo = localtime(&current_time); timeinfo->tm_year = target_year; timeinfo->tm_mon = target_month; timeinfo->tm_mday = target_day; timeinfo->tm_hour = target_hour; timeinfo->tm_min = target_minute; timeinfo->tm_sec = target_second; /*This converts it to something that difftime can work with */ time_t scheduled_time = mktime ( timeinfo ); *timeOfNextRecording = current_time + difftime(scheduled_time, current_time ); *durationOfNextRecording = 60; } else { /* Determine starting time and duration of next recording */ scheduleRecording(currentTime, timeOfNextRecording, durationOfNextRecording); } } Kind regards, Yannick
0
17
178
yannick.wiegers
Nov 14, 2019
In Configuration Support
Hi there, could someone please point out where I’m going wrong? I’m trying to edit the default settings of the firmware but I’m rather new to all of this stuff. I have tried editing the variables in the main.c file from AudioMoth-Firmware-Basic, then replacing the main.c file of AudioMoth-Project with it, and then building this entire project using the Simplicity IDE. Then I use the .bin file located within the ‘GNU ARM v4.9.3 Release’ directory to flash the firmware of the device. This however results in the device being bricked and requires me to reinstall the regular firmware. What am I doing wrong? Thanks in advance!
0
8
197

yannick.wiegers

More actions