Browse Source

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 6 years ago
parent
commit
757a3ac672
3 changed files with 12 additions and 3 deletions
  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 View File

193
 to change some settings while leaving others alone.  If there is no
193
 to change some settings while leaving others alone.  If there is no
194
 configuration, `No configuration` is printed instead.
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
 #### write
199
 #### write
197
 
200
 
198
 Usage: `write`
201
 Usage: `write`

+ 7
- 1
src/shell.c View File

254
     /* Get the current configuration */
254
     /* Get the current configuration */
255
     struct pdbs_config *cfg = pdbs_config_flash_read();
255
     struct pdbs_config *cfg = pdbs_config_flash_read();
256
     if (cfg == NULL) {
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
         return;
261
         return;
259
     }
262
     }
260
 
263
 
597
     pdb_config = cfg;
600
     pdb_config = cfg;
598
     pdbs_dpm_data = cfg->dpm_data;
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
     while (true) {
606
     while (true) {
601
         /* Print the prompt */
607
         /* Print the prompt */
602
         chprintf(chp, "PDBS) ");
608
         chprintf(chp, "PDBS) ");

+ 2
- 2
src/usbcfg.c View File

199
  * Serial Number string.
199
  * Serial Number string.
200
  */
200
  */
201
 static const uint8_t vcom_string3[] = {
201
 static const uint8_t vcom_string3[] = {
202
-    USB_DESC_BYTE(12),                    /* bLength.                         */
202
+    USB_DESC_BYTE(20),                    /* bLength.                         */
203
     USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType.                 */
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…
Cancel
Save