Skip to content

Commit

Permalink
Bug fixes, removed #if 0'd out init code. More or less working.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 12, 1999
1 parent 18ec3e1 commit b28443b
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions dev_test.c
Expand Up @@ -36,13 +36,9 @@ static void testdev_updateDevice(unsigned char *levels)
int max = devInfo.numChannels;
int i;
int j;
unsigned char endCoordinates[2];
unsigned char buffer[columns * 2];
int starCount;

lseek(cons, 2, SEEK_SET);
read(cons, endCoordinates, 2);

buffer[0] = '[';
buffer[1] = 7;
buffer[(columns * 2) - 2] = ']';
Expand All @@ -53,18 +49,16 @@ static void testdev_updateDevice(unsigned char *levels)
starCount = ((int) (((double) levels[i] / 255.0) * columns)) * 2;
starCount += 2; /* add two since '[' is first char... */

for (j = 2; j < columns * 2; j += 2)
for (j = 2; j < (columns - 1) * 2; j += 2)
{
buffer[j] = ((j < starCount) ? '*' : ' ');
buffer[j + 1] = channelColor[i];
} /* for */

lseek(cons, (i * columns) + 4, SEEK_SET);
lseek(cons, (i * (columns * 2)) + 4, SEEK_SET);
write(cons, buffer, columns * 2);
} /* for */

lseek(cons, 2, SEEK_SET);
write(cons, &endCoordinates, 2);
} /* testdev_updateDevice */


Expand Down Expand Up @@ -105,8 +99,7 @@ static int setupConsole(char *tty)
{
lines = br[0];
columns = br[1];
#if 0
buf = malloc(lines * columns);
buf = malloc((lines * columns) * 2);
if (buf == NULL)
close(rc);
else
Expand All @@ -126,8 +119,6 @@ static int setupConsole(char *tty)
write(rc, br, 4);
retVal = rc;
} /* else */
#endif
retVal = rc; // !!! TEMP.
} /* else */
} /* if */
} /* if */
Expand Down Expand Up @@ -176,8 +167,15 @@ static void testdev_deinitialize(void)

static int testdev_channelSet(int channel, int intensity)
{
channelColor[channel] = 7; // !!! finish this.
return(0);
int retVal = -1;

if (channel < devInfo.numChannels)
{
channelColor[channel] = 7; // !!! finish this.
retVal = 0;
} /* if */

return(retVal);
} /* testdev_channelSet */


Expand Down

0 comments on commit b28443b

Please sign in to comment.