Improved web page and fixed some bugs.
- JOYSTICK_DEBUG was left on...turned it off - Web page fields now have type='number' so they bring up a number keyboard - Refresh the brightness when it changes.
This commit is contained in:
@@ -107,7 +107,7 @@ RunningMedian MPUAngleSamples = RunningMedian(5);
|
||||
RunningMedian MPUWobbleSamples = RunningMedian(5);
|
||||
iSin isin = iSin();
|
||||
|
||||
#define JOYSTICK_DEBUG // comment out to stop serial debugging
|
||||
//#define JOYSTICK_DEBUG // comment out to stop serial debugging
|
||||
|
||||
// POOLS
|
||||
#define LIFE_LEDS 3
|
||||
@@ -1065,13 +1065,17 @@ void screenSaverTick(){
|
||||
}
|
||||
}else if(mode >= 1){
|
||||
// Random flashes
|
||||
|
||||
randomSeed(mm);
|
||||
for(i = 0; i<user_settings.led_count; i++){
|
||||
if(random8(20) == 0){
|
||||
leds[i] = CHSV( 25, 255, 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
@@ -1235,3 +1239,4 @@ long map_constrain(long x, long in_min, long in_max, long out_min, long out_max)
|
||||
return map(x, in_min, in_max, out_min, out_max);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ void change_setting(char paramCode, uint16_t newValue)
|
||||
|
||||
case 'B': // brightness
|
||||
user_settings.led_brightness = constrain(newValue, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
|
||||
FastLED.setBrightness(user_settings.led_brightness);
|
||||
settings_eeprom_write();
|
||||
break;
|
||||
|
||||
|
||||
11
twang_mpu.h
11
twang_mpu.h
@@ -9,12 +9,15 @@ class Twang_MPU
|
||||
public:
|
||||
void initialize();
|
||||
void getMotion6(int16_t* xAccel, int16_t* yAccel, int16_t* zAccel, int16_t* xGyro, int16_t* yGyro, int16_t* zGyro);
|
||||
bool verify();
|
||||
|
||||
private:
|
||||
static const uint8_t MPU_ADDR = 0x68;
|
||||
static const uint8_t PWR_MGMT_1 = 0x6B;
|
||||
static const uint8_t MPU_DATA_REG_START = 0x3B;
|
||||
static const uint8_t MPU_DATA_LEN = 14;
|
||||
static const uint8_t MPU_DATA_WHO_AM_I = 0x75;
|
||||
|
||||
};
|
||||
|
||||
void Twang_MPU::initialize()
|
||||
@@ -25,6 +28,14 @@ void Twang_MPU::initialize()
|
||||
Wire.endTransmission(true);
|
||||
}
|
||||
|
||||
bool Twang_MPU::verify()
|
||||
{
|
||||
Wire.beginTransmission(MPU_ADDR);
|
||||
Wire.write(MPU_DATA_WHO_AM_I);
|
||||
Wire.endTransmission(false);
|
||||
Wire.requestFrom(MPU_ADDR,1,true); // read the whole MPU data section
|
||||
return (Wire.read() == MPU_ADDR);
|
||||
}
|
||||
|
||||
void Twang_MPU::getMotion6(int16_t* xAccel, int16_t* yAccel, int16_t* zAccel, int16_t* xGyro, int16_t* yGyro, int16_t* zGyro)
|
||||
{
|
||||
|
||||
24
wifi_ap.h
24
wifi_ap.h
@@ -54,29 +54,29 @@ void sendStatsPage(WiFiClient client) {
|
||||
|
||||
client.print("<table>");
|
||||
|
||||
client.print("<tr><td>LED Count (100-1000)</td><td><form><input type='text' name='C' value='");
|
||||
client.print("<tr><td>LED Count (60-1000)</td><td><form><input type='number' name='C' value='");
|
||||
client.print(user_settings.led_count);
|
||||
client.print ("' size='4'><input type='submit'></form></td></tr>");
|
||||
client.print ("' min='60' max='1000'><input type='submit'></form></td></tr>");
|
||||
|
||||
client.print("<tr><td>Brightness (10-255)</td><td><form><input type='text' name='B' value='");
|
||||
client.print("<tr><td>Brightness (10-255)</td><td><form><input type='number' name='B' value='");
|
||||
client.print(user_settings.led_brightness);
|
||||
client.print ("' size='4'><input type='submit'></form></td></tr>");
|
||||
client.print ("' min='10' max='255'><input type='submit'></form></td></tr>");
|
||||
|
||||
client.print("<tr><td>Sound Volume (0-255)</td><td><form><input type='text' name='S' value='");
|
||||
client.print("<tr><td>Sound Volume (0-255)</td><td><form><input type='number' name='S' value='");
|
||||
client.print(user_settings.audio_volume);
|
||||
client.print("' size='4'><input type='submit'></form></td></tr>");
|
||||
client.print("' min='0' max='255'><input type='submit'></form></td></tr>");
|
||||
|
||||
client.print("<tr><td>Joystick Deadzone (3-12)</td><td><form><input type='text' name='D' value='");
|
||||
client.print("<tr><td>Joystick Deadzone (3-12)</td><td><form><input type='number' name='D' value='");
|
||||
client.print(user_settings.joystick_deadzone);
|
||||
client.print("' size='4'><input type='submit'></form></td></tr>");
|
||||
client.print("' min='3' max='12'><input type='submit'></form></td></tr>");
|
||||
|
||||
client.print("<tr><td>Attack Sensitivity (20000-35000)</td><td><form><input type='text' name='A' value='");
|
||||
client.print("<tr><td>Attack Sensitivity (20000-35000)</td><td><form><input type='number' name='A' value='");
|
||||
client.print(user_settings.attack_threshold);
|
||||
client.print("' size='4'><input type='submit'></form></td></tr>");
|
||||
client.print("' min='2000' max='35000'><input type='submit'></form></td></tr>");
|
||||
|
||||
client.print("<tr><td>Lives Per Level (3-9)</td><td><form><input type='text' name='L' value='");
|
||||
client.print("<tr><td>Lives Per Level (3-9)</td><td><form><input type='number' name='L' value='");
|
||||
client.print(user_settings.lives_per_level);
|
||||
client.print("' size='4'><input type='submit'></form></td></tr>");
|
||||
client.print("' min='3' max='9'><input type='submit'></form></td></tr>");
|
||||
|
||||
client.print("</table>");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user