sneakthief Posted October 12, 2009 Report Posted October 12, 2009 I updated my toolchain for the first time in a few years to the latest versions - now the midi sysex forwarding routine doesn't compile anymore http://www.ucapps.de/mios_c_forward_chn1.htmlThis is the error I get:"main.c:236 warning 94: comparison is always true due to limited range of data type" In reference to this line: if( fx_status != 0xff )///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS when a MIDI byte has been received ///////////////////////////////////////////////////////////////////////////// void MPROC_NotifyReceivedByte(unsigned char byte) __wparam { static char fx_status; // normal MIDI events are forwarded in MPROC_NotifyReceivedEvnt // this function handles sysex and realtime messages if( byte & 0x80 ) { // Status message if( byte >= 0xf0 ) MIOS_MIDI_TxBufferPut(byte); // transfer byte // determine status if( byte == 0xf0 ) { fx_status = 0xff; // forward until 0xf7 } else if( byte == 0xf7 ) { fx_status = 0; // f7 reached, no forward } else if( byte == 0xf1 || byte == 0xf3 ) { fx_status = 1; // expecting one additional byte } else if( byte == 0xf2 ) { fx_status = 2; // expecting two additional bytes } else { fx_status = 0; // expecting no additional byte } } else { // check if fx status active if( fx_status ) { // forward data byte MIOS_MIDI_TxBufferPut(byte); // decrement counter if required if( fx_status != 0xff ) --fx_status; } } } I even tried starting from scratch with the simple Clockbox v1c and replace the empty "When a MIDI byte has been received" routine and I still get this error. Quote
nILS Posted October 12, 2009 Report Posted October 12, 2009 char fx_status;seems to default to a signed value (-128..127) so it will never ever be == 0xFF (255). If you use unsigned char fx_status;it'll work. Quote
TK. Posted October 12, 2009 Report Posted October 12, 2009 Yes, it will work with "unsigned char".But:"main.c:236 warning 94: comparison is always true due to limited range of data type" Is only a warning, the project should be built regardless of this message.Are there additional messages?Best Regards, Thorsten. Quote
sneakthief Posted October 12, 2009 Author Report Posted October 12, 2009 Thanks - it works now! I took out "static char fx_status;" and instead used "unsigned char fx_status;" TK - Yes, it fully compiled before and there weren't any more error messages. However, it didn't pass sysex correctly anymore. Quote
jackchaos Posted November 20, 2009 Report Posted November 20, 2009 Thanks - it works now! I took out "static char fx_status;" and instead used "unsigned char fx_status;" It should read: static unsigned char fx_status; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.