From 026342b4b69da68c29c288a6481aae36b9779438 Mon Sep 17 00:00:00 2001 From: Ed Walker Date: Sat, 6 Feb 2021 09:14:38 -0800 Subject: [PATCH] Add video format to camera initialization. --- visca_controller/src/visca_controller.cpp | 12 ++++++++--- visca_controller/src/visca_controller.h | 26 +++++++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/visca_controller/src/visca_controller.cpp b/visca_controller/src/visca_controller.cpp index 2061ef3..bef5c5c 100644 --- a/visca_controller/src/visca_controller.cpp +++ b/visca_controller/src/visca_controller.cpp @@ -318,19 +318,25 @@ void sendViscaPacket(byte *packet, int byteSize) { void initCameras() { //Send Address command Serial.println("Setting addresses..."); - sendViscaPacket(address_command, sizeof(address_command)); + sendViscaPacket(addressCommand, sizeof(addressCommand)); delay(delayTime); //delay to allow camera time for next command receiveViscaData(); // Turn off IR control Serial.println("Disabling IR control..."); - sendViscaPacket(ir_off, sizeof(ir_off)); + sendViscaPacket(irOff, sizeof(irOff)); + delay(delayTime); //delay to allow camera time for next command + receiveViscaData(); + + // Set camera resolution. Needed for camera w/o DIP switch control of video format. + Serial.println("Setting camera resolution..."); + sendViscaPacket(videoFormat, sizeof(videoFormat)); delay(delayTime); //delay to allow camera time for next command receiveViscaData(); //Send IF_clear command Serial.println("Sending IF_Clear..."); - sendViscaPacket(if_clear, sizeof(if_clear)); + sendViscaPacket(ifClear, sizeof(ifClear)); delay(delayTime); //delay to allow camera time for next command receiveViscaData(); } diff --git a/visca_controller/src/visca_controller.h b/visca_controller/src/visca_controller.h index a83f569..96e44aa 100644 --- a/visca_controller/src/visca_controller.h +++ b/visca_controller/src/visca_controller.h @@ -105,12 +105,26 @@ byte wbTableManual[6] = { 0x81, 0x01, 0x04, 0x35, 0x06, 0xff }; byte wbTableDirect[9] = { 0x81, 0x01, 0x04, 0x75, 0x00, 0x00, 0x0, 0x00, 0xff }; // 8x 01 04 75 0p 0q 0r 0s ff pqrs = wb table. // Config -byte address_command[4] = { 0x88, 0x30, 0x01, 0xFF }; // Sets camera address (Needed for Daisy Chaining) -byte if_clear[5] = { 0x88, 0x01, 0x00, 0x01, 0xFF }; // Checks to see if communication line is clear -byte ir_off[6] = { 0x81, 0x01, 0x06, 0x09, 0x03, 0xff }; // Turn off IR control (required for speed control of Pan/Tilt on TelePresence cameras) -byte callLedOn[6] = { 0x81, 0x01, 0x33, 0x01, 0x01, 0xff}; -byte callLedOff[6] = { 0x81, 0x01, 0x33, 0x01, 0x00, 0xff}; -byte callLedBlink[6] = { 0x81, 0x01, 0x33, 0x01, 0x02, 0xff}; +byte addressCommand[4] = {0x88, 0x30, 0x01, 0xFF }; // Sets camera address (Needed for Daisy Chaining) +byte ifClear[5] = {0x88, 0x01, 0x00, 0x01, 0xFF }; // Checks to see if communication line is clear +byte irOff[6] = {0x81, 0x01, 0x06, 0x09, 0x03, 0xff }; // Turn off IR control (required for speed control of Pan/Tilt on TelePresence cameras) +byte callLedOn[6] = { 0x81, 0x01, 0x33, 0x01, 0x01, 0xff }; +byte callLedOff[6] = { 0x81, 0x01, 0x33, 0x01, 0x00, 0xff }; +byte callLedBlink[6] = { 0x81, 0x01, 0x33, 0x01, 0x02, 0xff }; +/* + * Video formats values: + * Value HDMI SDI + * 0x00 1080p25 1080p25 + * 0x01 1080p30 1080p30 + * 0x02 1080p50 720p50 + * 0x03 1080p60 720p60 + * 0x04 720p25 720p25 + * 0x05 720p30 720p30 + * 0x06 720p50 720p50 + * 0x07 720p60 720p60 + */ +byte format = 0x01; +byte videoFormat[7] = { 0x81, 0x01, 0x35, 0x00, format, 0x00, 0xff }; // 8x 01 35 0p 0q 0r ff p = reserved, q = video mode, r = Used in PrecisionHD 720p camera. void sendViscaPacket(byte *packet, int byteSize); void handleHardwareControl();