Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>pull/365/head
parent
212861173c
commit
ef832250f0
@ -0,0 +1,51 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Kaleidoscope-EEPROM-Settings -- Basic EEPROM settings plugin for Kaleidoscope.
|
||||
* Copyright (C) 2017 Gergely Nagy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <Kaleidoscope-EEPROM-Settings.h>
|
||||
|
||||
namespace FocusHooks {
|
||||
bool settings (const char *command) {
|
||||
enum {
|
||||
ISVALID,
|
||||
GETVERSION,
|
||||
} subCommand;
|
||||
|
||||
if (strncmp_P (command, PSTR ("settings."), 9) != 0)
|
||||
return false;
|
||||
|
||||
if (strcmp_P (command + 9, PSTR ("valid?")) == 0)
|
||||
subCommand = ISVALID;
|
||||
else if (strcmp_P (command + 9, PSTR ("version")) == 0)
|
||||
subCommand = GETVERSION;
|
||||
else
|
||||
return false;
|
||||
|
||||
switch (subCommand) {
|
||||
case ISVALID:
|
||||
Serial.println (EEPROMSettings.isValid () ? F("yes") : F("no"));
|
||||
break;
|
||||
case GETVERSION:
|
||||
Serial.println (EEPROMSettings.version ());
|
||||
break;
|
||||
}
|
||||
|
||||
Serial.read ();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
@ -0,0 +1,33 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Kaleidoscope-EEPROM-Settings -- Basic EEPROM settings plugin for Kaleidoscope.
|
||||
* Copyright (C) 2017 Gergely Nagy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Kaleidoscope.h>
|
||||
|
||||
namespace FocusHooks {
|
||||
bool settings (const char *command);
|
||||
};
|
||||
|
||||
#define FOCUS_HOOK_SETTINGS FOCUS_HOOK(FocusHooks::settings, \
|
||||
"settings.valid?\n" \
|
||||
"---------------\n" \
|
||||
"Return whether the EEPROM settings are valid, or not.\n\n" \
|
||||
"settings.version\n" \
|
||||
"----------------\n" \
|
||||
"Return the version of the EEPROM settings.")
|
Loading…
Reference in new issue