Accept exposure targets as string arguments to be parsed

This commit is contained in:
Matt McWilliams 2023-07-05 14:46:43 -04:00
parent 58ce079330
commit a7db072dc6
2 changed files with 32 additions and 1 deletions

View File

@ -34,7 +34,7 @@ volatile long blinkLast = 0;
volatile long now; volatile long now;
volatile long last = -1; volatile long last = -1;
volatile long cameraFrame = 2000; volatile long cameraFrame = 3000;
volatile long start; volatile long start;
volatile long end; volatile long end;
@ -43,6 +43,8 @@ volatile char cmdChar = 'z';
volatile char sChar = 'z'; volatile char sChar = 'z';
volatile bool connectedOnce = false; volatile bool connectedOnce = false;
volatile String exposureString;
volatile long exposureTarget = 3000;
void setup () { void setup () {
@ -102,12 +104,25 @@ void cmd (char val) {
camera_direction(true); camera_direction(true);
} else if (val == mc.CAMERA_BACKWARD) { } else if (val == mc.CAMERA_BACKWARD) {
camera_direction(false); camera_direction(false);
} else if (val == mc.CAMERA_EXPOSURE) {
exposure();
} else if (val == mc.STATE) { } else if (val == mc.STATE) {
state(); state();
} }
cmdChar = 'z'; cmdChar = 'z';
} }
void exposure () {
exposureString = mc.getString();
parseExposureString();
cameraFrame = exposureTarget;
mc.confirm(mc.CAMERA_EXPOSURE);
}
void parseExposureString () {
exposureTarget = exposureString.toInt();
}
void s_cmd (char val) { void s_cmd (char val) {
if (val == 'C') { if (val == 'C') {
connected = true; connected = true;

View File

@ -32,6 +32,9 @@ volatile int cameraFrame = 2000;
volatile char cmdChar = 'z'; volatile char cmdChar = 'z';
volatile long now; volatile long now;
volatile String exposureString;
volatile long exposureTarget = 2000;
McopySerial mc; McopySerial mc;
void setup () { void setup () {
@ -68,11 +71,24 @@ void cmd (char val) {
camera_direction(false); camera_direction(false);
} else if (val == mc.CAMERA) { } else if (val == mc.CAMERA) {
camera(); camera();
} else if (val == mc.CAMERA_EXPOSURE) {
exposure();
} else if (val == mc.STATE) { } else if (val == mc.STATE) {
state(); state();
} }
} }
void exposure () {
exposureString = mc.getString();
parseExposureString();
cameraFrame = exposureTarget;
mc.confirm(mc.CAMERA_EXPOSURE);
}
void parseExposureString () {
exposureTarget = exposureString.toInt();
}
//null route direction //null route direction
void camera_direction (boolean state) { void camera_direction (boolean state) {
if (state) { if (state) {