xboxscene.org forums

Pages: 1 [2] 3

Author Topic: Tut: Display Temps In Freestyle Dashboard!  (Read 457 times)

metalguitarist112

  • Archived User
  • Jr. Member
  • *
  • Posts: 65
Tut: Display Temps In Freestyle Dashboard!
« Reply #15 on: February 23, 2010, 12:49:00 PM »

Sorry, but I have no control on whether he wants to make it open sourced or not, but you can ask him here.
Logged

Mattie

  • Recovered User
  • Full Member
  • *
  • Posts: 141
Tut: Display Temps In Freestyle Dashboard!
« Reply #16 on: February 23, 2010, 02:44:00 PM »

who says the source is closed? I'm just messing with it and these where all test builds that various people got from me. All my code will be submitted to the SVN we set up in agreement with the developer.
The reason it's not included yet is because i said people could share the testbuilds if they wanted.

The code needs cleaning up, and it will be shared when that is done, so no jumping to conclusions
(and if it is all sooooo extremely simple, you can just as well add it yourselves... nuff said)
Logged

p4r0l3

  • Archived User
  • Full Member
  • *
  • Posts: 194
Tut: Display Temps In Freestyle Dashboard!
« Reply #17 on: February 23, 2010, 02:45:00 PM »

Thanks for the modded xex! Temps work great, now theres no reason to boot XeXMenu from time to time
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
Tut: Display Temps In Freestyle Dashboard!
« Reply #18 on: February 23, 2010, 02:54:00 PM »

OMFG Mattie how could you not release code that's already been released!! grr.gif
You need to submit all changes in a txt file and all the compile details with an FAQ!!
Then you need to get permissions to write those documents to Xbins so all nubs can have access

Next time someone birthday releases you should make sure they do it right! laugh.gif
Logged

Mattie

  • Recovered User
  • Full Member
  • *
  • Posts: 141
Tut: Display Temps In Freestyle Dashboard!
« Reply #19 on: February 23, 2010, 03:26:00 PM »

QUOTE(Odb718 @ Feb 23 2010, 10:54 PM) View Post

OMFG Mattie how could you not release code that's already been released!! grr.gif
You need to submit all changes in a txt file and all the compile details with an FAQ!!
Then you need to get permissions to write those documents to Xbins so all nubs can have access

Next time someone birthday releases you should make sure they do it right! laugh.gif


lol nub, go ask god in heaven why he does stuff to you tongue.gif
Logged

Mattie

  • Recovered User
  • Full Member
  • *
  • Posts: 141
Tut: Display Temps In Freestyle Dashboard!
« Reply #20 on: February 23, 2010, 04:01:00 PM »

little bit i'm testing now (top of the screen): temperature on main screen

for those of you who dont mind there is no source available at the moment, you can get a xex on Efnet in #freestyledash (also if you just wanna hang out, make suggestions, help or get help skinning, etc)
Logged

rulevoid

  • Archived User
  • Newbie
  • *
  • Posts: 43
Tut: Display Temps In Freestyle Dashboard!
« Reply #21 on: February 23, 2010, 04:38:00 PM »

QUOTE(Mattie @ Feb 23 2010, 06:01 PM) View Post

little bit i'm testing now (top of the screen): temperature on main screen


Looks like your Fahrenheit conversion from Celsius is a bit off  tongue.gif


F = (9/5)*C+32
Logged

maselw

  • Archived User
  • Newbie
  • *
  • Posts: 5
Tut: Display Temps In Freestyle Dashboard!
« Reply #22 on: February 23, 2010, 07:46:00 PM »

QUOTE(Mattie @ Feb 24 2010, 12:01 AM) *

little bit i'm testing now (top of the screen): temperature on main screen


perfect!!! keep up the nice work ...
Logged

JQE

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
Tut: Display Temps In Freestyle Dashboard!
« Reply #23 on: February 23, 2010, 08:24:00 PM »

Hey sorry if i came across strong earlier, didn't realise it was a work in progress. looking forward to the code release.

maybe you could help out a hobby enthusiast...

this is my get temp code, when i run it the box freezes, i can't figure out what i am doing wrong...

now this is one of many iterations i have gone through.

First things.. i am not a coder.. i have no training in such.. i just like to tinker and learn.. so any help would be appreciated.



CODE
//Usage:  temps contains the returned temperature values
//          temps[0] = CPU
//          temps[1] = GPU
//          temps[2] = EDRAM
//          temps[3] = MB
string GetTemps(/*float *temps, bool celsius*/)
{
    unsigned char msg[0x10];
    unsigned char values[0x10];
    int i;
    float *temps;
    bool celsius = true;

    memset(msg, 0x00, 0x10);
    memset(values, 0x00, 0x10);

    msg[0] = 0x07;

    HalSendSMCMessage(msg, values);

    for(i=0; i<4; i++)
        temps = (values[i * 2 + 1] | (values[i * 2 +2] <<8)) / 256.0;        

    if(!celsius)
        for(i=0; i<4; i++)
            temps = (9/5) * temps + 32;

    string temperaturestring = sprintfaA("CPU: %0.1f\n GPU: %0.1f\n EDRAM: %0.1f\n MB: %0.1f\n",temps[0],temps[1],temps[2],temps[3]);
    return temperaturestring;
}

void CScnUtilities::ShowSystemStatus()
{
    //float * temperature;
    string temperaturestring;
    temperaturestring = GetTemps();
    
    memset(&overlapped,0,sizeof(overlapped));
HRESULT hr = XShowMessageBoxUI(0,L"System Status",strtowstr(temperaturestring).c_str(),1,btnOk,0,XMB_ERRORICON,&mbresult,&overlapped);
}
Logged

Porta360

  • Archived User
  • Jr. Member
  • *
  • Posts: 66
Tut: Display Temps In Freestyle Dashboard!
« Reply #24 on: February 23, 2010, 10:54:00 PM »

Mattie good work. maybe a option to display temps on main screen or utilities .. how about adding feature to make LEDs change color with Temp.... ?
What are the chances....
Logged

rocky5

  • Recovered User
  • Sr. Member
  • *
  • Posts: 369
Tut: Display Temps In Freestyle Dashboard!
« Reply #25 on: February 23, 2010, 11:05:00 PM »

I would love the option to disable GOD games as some emulators show in games when they shouldn't.
Logged

ZprivateZ

  • Archived User
  • Sr. Member
  • *
  • Posts: 288
Tut: Display Temps In Freestyle Dashboard!
« Reply #26 on: February 23, 2010, 11:13:00 PM »

Nice work, nice to have temps in Freestyle now. Temps in main screen would be great also from seeing it in your pic you posted.
Logged

p4r0l3

  • Archived User
  • Full Member
  • *
  • Posts: 194
Tut: Display Temps In Freestyle Dashboard!
« Reply #27 on: February 24, 2010, 12:20:00 AM »

Each led 1-4 corresponds to a temp (cpu,gpu,eerom,mb) on my modded freestyle.

configured as green <= 40C, orange <= 50C, red >50C.
these are good ranges for my box, but then again i'm not running a xenon.

i have setTempLEDS() called as the clock updates (every second)

works great here! thanks to those who've made this possible

CODE

void setTempLEDS(){
    smc mySMC;
    
    float temperature[4];
    int delta = 0;

    mySMC.GetTemps(temperature,true);

    if (temperature[0]<=40){
        if (one != GREEN){
            one = GREEN;
            delta=1;}}
    else if (temperature[0]<=50){
        if (one != ORANGE){
            one = ORANGE;
            delta = 1;}}
    else{
        if (one != RED){
            one = RED;
            delta = 1;}}

    if (temperature[1]<=40){
        if (two != GREEN){
            two = GREEN;
            delta=1;}}
    else if (temperature[1]<=50){
        if (two != ORANGE){
            two = ORANGE;
            delta = 1;}}
    else{
        if (two != RED){
            two = RED;
            delta = 1;}}

    if (temperature[2]<=40){
        if (three != GREEN){
            three = GREEN;
            delta=1;}}
    else if (temperature[2]<=50){
        if (three != ORANGE){
            three = ORANGE;
            delta = 1;}}
    else{
        if (three != RED){
            three = RED;
            delta = 1;}}

    if (temperature[3]<=40){
        if (four != GREEN){
            four = GREEN;
            delta=1;}}
    else if (temperature[3]<=50){
        if (four != ORANGE){
            four = ORANGE;
            delta = 1;}}
    else{
        if (four != RED){
            four = RED;
            delta = 1;}}

    if (delta==1)
        mySMC.SetLEDS(one,two,three,four);
}


Props to hemah for the needed code!

QUOTE(hemah @ Feb 18 2010, 06:21 PM) *


smc_constants.h
CODE
//Thanks to www.free60.org/SMC for helping me get front LEDs right
#pragma once
#ifndef _SMC_CONSTANTS_H
#define _SMC_CONSTANTS_H

//sorry for the extreme amount of constants trying to make functions
//easier to use

//Power LED
#define POWER_LED_BLINK            0x10
#define POWER_LED_DEFAULT        0x02
#define POWER_LED_ON            0x01
#define POWER_LED_OFF            0X03

//Quadrant LEDs
//NOTE: LED constants are determined with console laying down
//        with LED color bits being, starting from tope left 1, 2, 4, 8

//Thanks to unknown v2 for the following
typedef enum _LEDState
{
    OFF        = 0x00,
    RED        = 0x08,
    GREEN    = 0x80,
    ORANGE    = 0x88
}LEDState;
#endif


smc.h

CODE
//Thanks to tmbinc for smc.c
#pragma once
#ifndef _SMC_H
#define _SMC_H

#include
#include "smc_constants.h"

//Call to SMC message function in xboxkrnl.lib
extern "C" void __stdcall HalSendSMCMessage(LPVOID input, LPVOID output);   //thanks to cory1492

class smc
{
    public:
        void SetPowerLED(unsigned char command, bool animate);
        void SetLEDS(LEDState s1, LEDState s2, LEDState s3, LEDState s4);    //Thanks unknown v2
        void GetTemps(float *temps, bool celsius);

    private:
};

#endif


smc.cpp

CODE
#include "smc.h"
#include
//Usage: command is one of the POWER_LED constants from smc_constant.h
//         animate is true for ring LED startup light sequence
void smc::SetPowerLED(unsigned char command, bool animate)
{
    unsigned char msg[0x10];

    memset(msg, 0x00, 0x10);
    msg[0] = 0x8c;
    msg[1] = command;
    msg[2] = (animate ? 0x01 : 0x00);

    HalSendSMCMessage(msg, NULL);
}
//Usage: color is one of LED constants from smc_constant.h
void smc::SetLEDS(LEDState s1, LEDState s2, LEDState s3, LEDState s4)
{
    unsigned char msg[0x10];
    msg[0] = 0x99;
    msg[1] = 0x01;
    msg[2] = ((s1>>3) | (s2>>2) | (s3>>1) | (s4));    //Thanks unknown v2
    HalSendSMCMessage(msg, NULL);
}

//Usage:  temps contains the returned temperature values
//          temps[0] = CPU
//          temps[1] = GPU
//          temps[2] = EDRAM
//          temps[3] = MB
void smc::GetTemps(float *temps, bool celsius)
{
    unsigned char msg[0x10];
    unsigned char values[0x10];
    int i;

    memset(msg, 0x00, 0x10);
    memset(values, 0x00, 0x10);

    msg[0] = 0x07;

    HalSendSMCMessage(msg, values);

    for(i=0; i<4; i++)
        temps = (values[i * 2 + 1] | (values[i * 2 +2] <<8)) / 256.0;        

    if(!celsius)
        for(i=0; i<4; i++)
            temps = (9/5) * temps + 32;
}



This post has been edited by p4r0l3: Feb 24 2010, 08:20 AM
Logged

Mattie

  • Recovered User
  • Full Member
  • *
  • Posts: 141
Tut: Display Temps In Freestyle Dashboard!
« Reply #28 on: February 24, 2010, 04:23:00 AM »

i will try to put some of the suggestions in (leds on temps, the correct fahrenheit conversion, try and mak GoD listing more configurable)

@JQE, i dont know why yours crashes, i actually had the same and it looked like it had something to do
with passing the float* temps from one function to the other, so i rewrote it to just return 1 temp at a time.


QUOTE(rulevoid @ Feb 24 2010, 12:38 AM) *

Looks like your Fahrenheit conversion from Celsius is a bit off  (IMG:style_emoticons/default/tongue.gif)
F = (9/5)*C+32


its weird, because i have:
if(!Celsius) temp = (9/5) * temp + 32;

yet it looks like it only adds the 32...
have to look into that when i'm home
Logged

p4r0l3

  • Archived User
  • Full Member
  • *
  • Posts: 194
Tut: Display Temps In Freestyle Dashboard!
« Reply #29 on: February 24, 2010, 09:36:00 AM »

yeah "float * temps" seems to crash my 360 at least. go ahead & declare it to be a 4 slot array & it should work fine. "float temps[4]"
Logged
Pages: 1 [2] 3