Merge pull request #523 from keyboardio/EEPROMSettings/default_layer-fix

EEPROM-Settings: Fix default_layer(255)
pull/527/head
Jesse Vincent 6 years ago committed by GitHub
commit 842afd6616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,12 +50,13 @@ uint16_t EEPROMSettings::crc(void) {
} }
uint8_t EEPROMSettings::default_layer(uint8_t layer) { uint8_t EEPROMSettings::default_layer(uint8_t layer) {
if (layer == 0xff) if (layer < layer_count) {
return settings_.default_layer;
if (settings_.default_layer != layer)
Layer.move(layer); Layer.move(layer);
settings_.default_layer = layer; settings_.default_layer = layer;
}
if (layer == 0xff) {
settings_.default_layer = layer;
}
update(); update();
return settings_.default_layer; return settings_.default_layer;
} }

@ -40,7 +40,10 @@ class EEPROMSettings : public kaleidoscope::Plugin {
static uint16_t crc(void); static uint16_t crc(void);
static uint16_t used(void); static uint16_t used(void);
static uint8_t default_layer(uint8_t layer = 0xff); static uint8_t default_layer(uint8_t layer);
static uint8_t default_layer() {
return settings_.default_layer;
}
private: private:
static uint16_t next_start_; static uint16_t next_start_;

Loading…
Cancel
Save