xboxscene.org forums

Author Topic: Problem Outputting The Temperature  (Read 68 times)

SamSam

  • Archived User
  • Jr. Member
  • *
  • Posts: 76
Problem Outputting The Temperature
« on: January 26, 2005, 10:24:00 PM »

sad.gif

When i try to use the function to get the temperature, everything i try writing with drawtext doesn't appear on the screen(normally it does). Did anyone have an idea of what can cause this, cause i don't see how it's related.

here's my code(the comment's are in french cause i am, but it's not important):

The function to read the temperature i had taken in a tutorial(same as the font of my earlier problem)
extern "C"
{
XBOXAPI LONG WINAPI HalReadSMBusValue(UCHAR devddress,
UCHAR offset, UCHAR readdw, LPBYTE pdata);
}

//Permet de lire la température
unsigned char *ReadTemps(void)
{
static unsigned char c[2];
int t;

memset(c,0,2);
Sleep(100);
t = 0;

while( !c[0] )
{
HalReadSMBusValue(0x99, 0, 0, c);
Sleep(10);
}

t = 1;

while( !c[1] )
{
HalReadSMBusValue(0x99, 1, 0, c+1);
Sleep(10);
}

return c;
}


my var declarations

   WCHAR wPosX[4] = L"";
   WCHAR wPosY[4] = L"";
   WCHAR wTemp[8] = L"";
   unsigned char *cTemp;


and my code to get the temperature and to convert the text in wchar so i can output it.

//Lecture de la température
   cTemp = ReadTemps();

   //conversion de float en wchar de la position
   swprintf(wPosX,L"%g",fPosX);
   swprintf(wPosY,L"%g",fPosY);
   //Conversion de la température
   swprintf(wTemp,L"%c",cTemp[0]);
   //wTemp = (char)cTemp[0];

    // Begin the scene
    g_pd3dDevice->BeginScene();
//Limites Tv: 35-10, 600-160
   cFont.DrawText(fPosX, fPosY,0xffff00aa,L"David Pu",XBFONT_CENTER_X);
   cFont.DrawText(320, 240, 0xff00ff00, L"Testing hihoha", 2);
   cFont.DrawText(50,380,0xfff00fff,wPosX,XBFONT_LEFT);
   cFont.DrawText(50,420,0xfff00fff,wPosY,XBFONT_LEFT);
   cFont.DrawText(50,340,0xffff00ff,wTemp,XBFONT_LEFT);
Logged

SamSam

  • Archived User
  • Jr. Member
  • *
  • Posts: 76
Problem Outputting The Temperature
« Reply #1 on: February 03, 2005, 11:20:00 AM »

no one have an idea of what's causing this?
Logged

KaMbiOkIkA

  • Archived User
  • Newbie
  • *
  • Posts: 24
Problem Outputting The Temperature
« Reply #2 on: February 03, 2005, 12:33:00 PM »

Hello SamSam,

Do you know gueux.be forums for french people ???

Your ReadTemp function isn't good.
This one should is :

int XBOXCPUTemp(void)
{
   long BTemp;
   HalReadSMBusValue(SMBDEV_PIC16L,0x09,0,(BYTE *)&BTemp);
   return (int)BTemp;
}
int XBOXSYSTemp(void)
{
   long BTemp;
   HalReadSMBusValue(SMBDEV_PIC16L,0x0a,0,(BYTE *)&BTemp);
   return (int)BTemp;
}

++
Logged

SamSam

  • Archived User
  • Jr. Member
  • *
  • Posts: 76
Problem Outputting The Temperature
« Reply #3 on: February 03, 2005, 01:58:00 PM »

thanks,works fine exept I had a little problem with SMBDEV_PIC16L that is not recognized, but i replaced it with it's value and it worked fine.
Logged