EEPROM-Settings: Fix default_layer(255)

We should be using a different variant of the `default_layer()` method to query
the default layer instead of abusing 0xff as a special valie.

Fixes #522.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/523/head
Gergely Nagy 6 years ago
parent ceffac4b3f
commit 1279ffafcb
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

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

@ -40,7 +40,10 @@ class EEPROMSettings : public kaleidoscope::Plugin {
static uint16_t crc(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:
static uint16_t next_start_;

Loading…
Cancel
Save