Skip to content

Commit

Permalink
Changed static variables to instance variables in device classes
Browse files Browse the repository at this point in the history
  • Loading branch information
filips committed Nov 10, 2016
1 parent 421c21a commit 46430c4
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void ClientBMDHyperdeckStudio::begin(IPAddress ip) {
_wasRejected = false;
_askForClips = false;
_askForClipNames = false;

clipCounter = 0;
clipIndex = 0;
statusRequestCycleStep = 0;
}

/**
Expand Down Expand Up @@ -107,8 +111,6 @@ void ClientBMDHyperdeckStudio::_parseline() {
// ISSUE:
// If you get a return code "120 connection rejected", it seems to mean that another connection (or a previous, old "hanging" connection!) is still active. After a certain timeout time, this state is usually resolved automatically (within a minute or so.)
// If you experience the problem above with an old hanging connection from yourself, try to call "disconnect()" immediately after a connection. This has proven to work at some point and was attempted implemented using "_wasRejected" below. However, it didn't turn out to work as well as hoped and it's still frustrating and unclear how to get a more predictable connection established to the HyperDeck.
static uint8_t clipCounter;
static uint8_t clipIndex;

if (!strcmp(_buffer, "")) {
_section = 0;
Expand Down Expand Up @@ -518,7 +520,6 @@ void ClientBMDHyperdeckStudio::_sendStatus() {
_enableNotifications(); // Check notifications status.
setRemoteEnable(true); // Force remote to be set!

static uint8_t statusRequestCycleStep = 0;
statusRequestCycleStep++;
_pullStatus(statusRequestCycleStep);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class ClientBMDHyperdeckStudio : public SkaarhojTCPClient {
char _Hyperdeck_currentFile[ClientBMDHyperdeckStudio_CLIPNAMELEN];
uint8_t _Hyperdeck_currentClipId;

uint8_t clipCounter;
uint8_t clipIndex;
uint8_t statusRequestCycleStep;

public:
ClientBMDHyperdeckStudio();
void begin(IPAddress ip);
Expand Down
5 changes: 3 additions & 2 deletions ArduinoLibs/ClientKramerVP728/ClientKramerVP728.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ void ClientKramerVP728::begin(){
// A command queue has been implemented in this subclass.
_queueWriteIndex = 0;
_queueReadIndex = 0;

i = 0;
}

/**
Expand Down Expand Up @@ -235,11 +237,10 @@ void ClientKramerVP728::_parseline() {
void ClientKramerVP728::_sendStatus() {
// This array has a list of all "functions" from the scaler for which to retrieve a status value:
const static uint8_t functionListToStatusUpdate[] = {0,12,13,14,15,16,17,25,27,32,47,48,49,50,51,54,89,90,91,101,102,103,135,153,154};
static uint8_t i;

// Initialize:
if (_statusRequestInterval!=500) {
_statusRequestInterval = 500; // This is because we want sendStatus to be continously called until we have gotten all commands sent - then we will set it back to 60000 ms.
_statusRequestInterval = 500; // This is because we want sendStatus to be continuously called until we have gotten all commands sent - then we will set it back to 60000 ms.
i = 0;
}

Expand Down
1 change: 1 addition & 0 deletions ArduinoLibs/ClientKramerVP728/ClientKramerVP728.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ClientKramerVP728 : public SkaarhojSerialClient
uint8_t _queueWriteIndex; // Index in queue, last written
uint8_t _queueReadIndex; // Index in queue, last sent
uint8_t _queueEntryWritePointer; // Index to chars in the current queue entry.
uint8_t i;


// States:
Expand Down
4 changes: 2 additions & 2 deletions ArduinoLibs/ClientSonyVISCAoverIP/ClientSonyVISCAoverIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ void ClientSonyVISCAoverIP::begin(const IPAddress ip) {

_lastContact = 0;
_serialOutput = 0;

neverConnected = true;
}

/**
Expand Down Expand Up @@ -87,8 +89,6 @@ void ClientSonyVISCAoverIP::connect() {
* Other recommendations might come up in the future.
*/
void ClientSonyVISCAoverIP::runLoop(uint16_t delayTime) {

static bool neverConnected = true;
if (neverConnected) {
neverConnected = false;
connect();
Expand Down
1 change: 1 addition & 0 deletions ArduinoLibs/ClientSonyVISCAoverIP/ClientSonyVISCAoverIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ClientSonyVISCAoverIP {

// Private Variables in ClientSonyVISCAoverIP.h:
uint8_t cameraIris;
bool neverConnected;

public:

Expand Down
3 changes: 1 addition & 2 deletions ArduinoLibs/ClientVMixUDP/ClientVMixUDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void ClientVMixUDP::begin(const IPAddress ip) {
_lastContact = 0;
_serialOutput = 0;

neverConnected = true;
resetCommandBundle();
}

Expand Down Expand Up @@ -86,8 +87,6 @@ void ClientVMixUDP::connect() {
* Other recommendations might come up in the future.
*/
void ClientVMixUDP::runLoop(uint16_t delayTime) {

static bool neverConnected = true;
if (neverConnected) {
neverConnected = false;
connect();
Expand Down
3 changes: 2 additions & 1 deletion ArduinoLibs/ClientVMixUDP/ClientVMixUDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ class ClientVMixUDP {
void _prepareCommandPacket(const char *cmdString, uint8_t cmdBytes, bool indexMatch = true);
void _finishCommandPacket();


private:
bool neverConnected;



Expand Down

0 comments on commit 46430c4

Please sign in to comment.