Skip to content

Commit

Permalink
Fixed the bug that the process to interpret a received OSC message is…
Browse files Browse the repository at this point in the history
… stopped.
  • Loading branch information
Shunichi Yamamoto committed Apr 26, 2014
1 parent eb79aec commit eabee33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions tkrworks-libs/Common/osc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with PICrouter. if not, see <http:/www.gnu.org/licenses/>.
*
* osc.c,v.1.7.0 2014/04/24
* osc.c,v.1.7.1 2014/04/26
*/

#include "osc.h"
Expand Down Expand Up @@ -258,7 +258,6 @@ const char msgSetPwmDuty3[] = "/pwm/duty/set/3";
const char msgSetPwmDuty4[] = "/pwm/duty/set/4";

// Variables
static BYTE state_index = 0;
static BYTE indexA = 0;
static BYTE indexB = 0;
static BYTE ringBufIndex = 0;
Expand Down Expand Up @@ -587,6 +586,7 @@ void getOSCPacket(void)

BOOL processOSCPacket(void)
{
static BYTE state_index = 0;
switch(state_index)
{
case 0:
Expand All @@ -598,17 +598,26 @@ BOOL processOSCPacket(void)
break;
case 1:
if(!extractAddressFromOSCPacket())
{
state_index = 0;
return FALSE;
}
state_index = 2;
break;
case 2:
if(!extractTypeTagFromOSCPacket())
{
state_index = 0;
return FALSE;
}
state_index = 3;
break;
case 3:
if(!extractArgumentsFromOSCPacket())
{
state_index = 0;
return FALSE;
}
state_index = 4;
break;
case 4:
Expand Down
4 changes: 2 additions & 2 deletions tkrworks-libs/Include/osc.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with PICrouter. if not, see <http:/www.gnu.org/licenses/>.
*
* osc.h,v.1.7.0 2014/04/24
* osc.h,v.1.7.1 2014/04/26
*/

#ifndef OSC_H
Expand All @@ -41,7 +41,7 @@
#define MAX_BUF_SIZE 64
#define MAX_PACKET_SIZE 320// 1024
#else
#define MAX_BUF_SIZE 48
#define MAX_BUF_SIZE 64
#define MAX_PACKET_SIZE 192// 1024
#endif
#define MAX_MESSAGE_LEN 160
Expand Down

0 comments on commit eabee33

Please sign in to comment.