Settings.hex and the backlight

Libraries, utilities, bootloaders...

Settings.hex and the backlight

Postby DFX2KX » Thu Aug 07, 2014 3:20 am

It appears that Settings.hex has a bit of a bug, where both ambient light sensor menu options seem to alter the same setting. after changing both Min and Max ambient light settings, the 'max' setting stays at 680, and the 'min' is whatever I set either 'min' or 'max' to.

I'll see if I can poke a bit at the code and figure out why it's doing that.
DFX2KX
 
Posts: 250
Joined: Mon Apr 14, 2014 3:48 am

Re: Settings.hex and the backlight

Postby rodot » Thu Aug 07, 2014 9:35 am

You're right, I just took a look at the code and here is the bug:
Code: Select all
    case 3: //ambient min
      while(1){
        if(gb.update()){
          gb.backlight.automatic = false;
          gb.backlight.set(backlightMax);
          if(changeValue(lightMin, 0, 1024, F("Min ambient light \n(when it's dark)\nassociated with\nmin backlight")))
            break;
          gb.display.print(F("\nCurrent ambient:"));
          gb.display.print(gb.backlight.ambientLight);
        }
      }
      gb.backlight.automatic = true;
      break;
    case 4: //ambient max
      while(1){
        if(gb.update()){
          gb.backlight.automatic = false;
          gb.backlight.set(backlightMin);
          if(changeValue(lightMin, 0, 1024, F("Max ambient light \n(when it's bright)\nassociated with\nmax backlight")))
            break;
          gb.display.print(F("\nCurrent ambient:"));
          gb.display.print(gb.backlight.ambientLight);
        }
      }


You can see it changes "lightMin" even when selecting "ambient max" (looks like a copy/past mistake :P). I'll correct that in the next update.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: Settings.hex and the backlight

Postby treflip » Thu Aug 07, 2014 1:55 pm

Also it would be nice if the values went back to max from 0... sometimes I am trying to set the max and then go past it to 0. It sucks having to wait to hit high values again!
treflip
 
Posts: 83
Joined: Fri May 30, 2014 4:50 pm
Location: Florida

Re: Settings.hex and the backlight

Postby DFX2KX » Thu Aug 07, 2014 9:05 pm

treflip wrote:Also it would be nice if the values went back to max from 0... sometimes I am trying to set the max and then go past it to 0. It sucks having to wait to hit high values again!


Also, I second that, Treflip.

Thanks Rodot! Proves to me I wasn't just unsure how it was supposed to work.
DFX2KX
 
Posts: 250
Joined: Mon Apr 14, 2014 3:48 am

Re: Settings.hex and the backlight

Postby rodot » Thu Aug 07, 2014 10:42 pm

I agree, that how it was supposed to work, I simply forgot to correct that but. I'll give it a look.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: Settings.hex and the backlight

Postby rodot » Fri Aug 08, 2014 10:22 am

It was because the variables were unsigned, bug solved. It'll be in the next commit.
Edit: it's now online on github
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: Settings.hex and the backlight

Postby DFX2KX » Sat Aug 09, 2014 9:43 pm

rodot wrote:It was because the variables were unsigned, bug solved. It'll be in the next commit.
Edit: it's now online on github


Awesome! Thanks. I'll test it in a bit, though I noticed the current one likes to reset settings every time SETTINGS.HEX is loaded. Is that intentional behavior?
DFX2KX
 
Posts: 250
Joined: Mon Apr 14, 2014 3:48 am

Re: Settings.hex and the backlight

Postby rodot » Sat Aug 09, 2014 10:32 pm

SETTING.HEX automatically restores the default settings and save them on start-up when there is no settings detected.
Did you load another game in between for your settings to be erased? Did you do it over USB, or from the micro SD card?
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: Settings.hex and the backlight

Postby DFX2KX » Sun Aug 10, 2014 7:40 am

rodot wrote:SETTING.HEX automatically restores the default settings and save them on start-up when there is no settings detected.
Did you load another game in between for your settings to be erased? Did you do it over USB, or from the micro SD card?


The version that you just uploaded seems to have fixed that problem. I'd tried it off of both USB and SD before. Huh! Working now!
DFX2KX
 
Posts: 250
Joined: Mon Apr 14, 2014 3:48 am

Re: Settings.hex and the backlight

Postby treflip » Sun Aug 10, 2014 1:06 pm

Yes, Thanks Rodot! That is much more usable for me to be able to flip around is very convenient. Thank you!!!
treflip
 
Posts: 83
Joined: Fri May 30, 2014 4:50 pm
Location: Florida


Return to Software Development

Who is online

Users browsing this forum: No registered users and 44 guests

cron