-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* Intervalometer / Timer for interval shooting. | ||
Copyright © 2022 Timur Khabibulin. | ||
All rights reserved. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
ISR(TIMER1_COMPA_vect) { | ||
hwTimer1.count++; // Период 1 с | ||
|
||
static uint32_t intervalTime; | ||
static bool sleepState = false; | ||
|
||
if (camSettings.longExpNR) intervalTime = camSettings.interval + camSettings.shutter_speed / 1000; | ||
else intervalTime = camSettings.interval; | ||
|
||
if (camSettings.hibernationSt) hibernation(intervalTime, sleepState); | ||
|
||
if (hwTimer1.count >= intervalTime) { | ||
if (camSettings.frame_rate > 0) { | ||
if (camSettings.AFControl) digitalWrite(FOCUS_PIN, HIGH); | ||
digitalWrite(SHUTTER_PIN, HIGH); | ||
} | ||
hw_Timer_1_Stop(); | ||
hw_Timer_2_Start(); | ||
} | ||
|
||
} | ||
|
||
ISR(TIMER2_COMPA_vect) { | ||
hwTimer2.count += 2; // Период 2 мс | ||
|
||
if (hwTimer2.count >= camSettings.shutter_speed) { | ||
if (camSettings.frame_rate > 0) { | ||
if (camSettings.AFControl) digitalWrite(FOCUS_PIN, LOW); | ||
digitalWrite(SHUTTER_PIN, LOW); | ||
camSettings.frame_rate--; | ||
} | ||
hw_Timer_2_Stop(); | ||
hw_Timer_1_Start(); | ||
} | ||
|
||
} |