ConfigScript.ino 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Arylic32 Config Utility
  3. * MClarkDev.com, 2022
  4. * ConfigScript.ino
  5. *
  6. * 1. Run this script to configure device.
  7. * 2. Flash Arylic32 firmware.
  8. */
  9. #define NET_NAME "network.name"
  10. #define NET_PASS "<passphrase>"
  11. #define DEV_NAME "Remote 1"
  12. #define DEV_TIMEOUT 30000
  13. #define ACTION_N "http://10.3.106.120/httpapi.asp?command=MCUKeyShortClick:1"
  14. #define ACTION_E "http://10.3.106.120/httpapi.asp?command=setPlayerCmd:next"
  15. #define ACTION_S "http://10.3.106.120/httpapi.asp?command=multiroom:Ungroup"
  16. #define ACTION_W "http://10.3.106.120/httpapi.asp?command=setPlayerCmd:prev"
  17. #define ACTION_C "http://10.3.106.120/httpapi.asp?command=setPlayerCmd:onepause"
  18. #define ACTION_UP "http://10.3.106.120/httpapi.asp?command=setPlayerCmd:Vol--"
  19. #define ACTION_DN "http://10.3.106.120/httpapi.asp?command=setPlayerCmd:Vol%2B%2B"
  20. #include "PropKeys.h"
  21. void setup() {
  22. ESP_LOGI(A32, "Formatting");
  23. nvs_flash_erase();
  24. nvs_flash_init();
  25. Preferences conf;
  26. ESP_LOGI(A32, "Configuring");
  27. conf.begin(A32, false);
  28. conf.putString(CONF_NET_NAME, NET_NAME);
  29. conf.putString(CONF_NET_PASS, NET_PASS);
  30. conf.putString(CONF_DEV_NAME, DEV_NAME);
  31. conf.putString("_cmd-1", ACTION_N);
  32. conf.putString("_cmd-2", ACTION_E);
  33. conf.putString("_cmd-4", ACTION_S);
  34. conf.putString("_cmd-8", ACTION_W);
  35. conf.putString("_cmd-16", ACTION_C);
  36. conf.putString("_cmd-97", ACTION_UP);
  37. conf.putString("_cmd-99", ACTION_DN);
  38. conf.putInt(CONF_DEV_TIMEOUT, DEV_TIMEOUT);
  39. conf.putString(CONF_UPDATEURL, DFLT_UPDATEURL);
  40. conf.putBool(CONF_CONFIGURED, true);
  41. conf.end();
  42. ESP_LOGI(A32, "Done.");
  43. }
  44. void loop() {}