Explorar el Código

Automatically run `load` when setup mode starts

Gavin had trouble with configuration because it isn't loaded on startup.
I realized that I've been caught with the same mistake myself before, so
since at least 2 out of ~65 people have done this, it's clearly a real
usability problem.

Now the configuration is automatically loaded from flash when setup mode
starts, so there's no need to type `load` to edit the configuration the
Sink already has.  If you're changing all the settings, you'll have to
type them all anyway, so I don't think there will be any surprises
because of this change.
Clara Hobbs hace 6 años
padre
commit
757a3ac672
Se han modificado 3 ficheros con 12 adiciones y 3 borrados
  1. 3
    0
      docs/console_config.md
  2. 7
    1
      src/shell.c
  3. 2
    2
      src/usbcfg.c

+ 3
- 0
docs/console_config.md Ver fichero

@@ -193,6 +193,9 @@ Loads the current configuration from flash into the buffer.  Useful if you want
193 193
 to change some settings while leaving others alone.  If there is no
194 194
 configuration, `No configuration` is printed instead.
195 195
 
196
+Starting with firmware version 1.3.0, this is automatically run when setup mode
197
+starts.
198
+
196 199
 #### write
197 200
 
198 201
 Usage: `write`

+ 7
- 1
src/shell.c Ver fichero

@@ -254,7 +254,10 @@ static void cmd_load(BaseSequentialStream *chp, int argc, char *argv[])
254 254
     /* Get the current configuration */
255 255
     struct pdbs_config *cfg = pdbs_config_flash_read();
256 256
     if (cfg == NULL) {
257
-        chprintf(chp, "No configuration\r\n");
257
+        /* When we run this at shell startup, we want it to be quiet */
258
+        if (chp != NULL) {
259
+            chprintf(chp, "No configuration\r\n");
260
+        }
258 261
         return;
259 262
     }
260 263
 
@@ -597,6 +600,9 @@ void pdbs_shell(struct pdb_config *cfg)
597 600
     pdb_config = cfg;
598 601
     pdbs_dpm_data = cfg->dpm_data;
599 602
 
603
+    /* Load the configuration before the shell starts */
604
+    cmd_load(NULL, 0, NULL);
605
+
600 606
     while (true) {
601 607
         /* Print the prompt */
602 608
         chprintf(chp, "PDBS) ");

+ 2
- 2
src/usbcfg.c Ver fichero

@@ -199,9 +199,9 @@ static const uint8_t vcom_string2[] = {
199 199
  * Serial Number string.
200 200
  */
201 201
 static const uint8_t vcom_string3[] = {
202
-    USB_DESC_BYTE(12),                    /* bLength.                         */
202
+    USB_DESC_BYTE(20),                    /* bLength.                         */
203 203
     USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType.                 */
204
-    '1', 0, '.', 0, '2', 0, '.', 0, '0', 0
204
+    '1', 0, '.', 0, '3', 0, '.', 0, '0', 0, '-', 0, 'd', 0, 'e', 0, 'v', 0
205 205
 };
206 206
 
207 207
 /*

Loading…
Cancelar
Guardar