index.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ArduPilot Custom Firmware Builder</title>
  6. <meta name="description"
  7. content="ArduPilot Custom Firmware Builder. It allows to build custom ArduPilot firmware by selecting the wanted features.">
  8. <meta name="author" content="ArduPilot Team">
  9. <meta name="viewport" content="width=device-width, initial-scale=1">
  10. <!-- OG Meta Tags to improve the way the post looks when you share the page on LinkedIn, Facebook, Google+ -->
  11. <meta property="og:site_name" content="ArduPilot"/>
  12. <meta property="og:site" content=""/>
  13. <meta property="og:title" content="ArduPilot Custom Firmware Builder"/>
  14. <meta property="og:description"
  15. content="ArduPilot Custom Firmware Builder. It allows to build custom ArduPilot firmware by selecting the wanted features."/>
  16. <!-- description shown in the actual shared post -->
  17. <meta property="og:type" content="website">
  18. <meta property="og:url" content="https://custom.ardupilot.org/">
  19. <meta property="og:image" content="https://ardupilot.org/application/files/6315/7552/1962/ArduPilot-Motto.png">
  20. <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='styles/main.css') }}">
  21. <script type="text/javascript" src="{{ url_for('static', filename='js/CollapsibleLists.js')}}"></script>
  22. </head>
  23. <body onload="javascript: reload()">
  24. <div id="main">
  25. <a href="https://custom.ardupilot.org/">
  26. <div id="logo">
  27. </div>
  28. </a>
  29. <div id="menu">
  30. <h2>ArduPilot Custom Firmware Builder</h2>
  31. <br><b>This site is EXPERIMENTAL</b>
  32. <p>Please select the required options for the custom firmware build.</p>
  33. <textarea style="float:right" readonly>hello</textarea>
  34. <form action="/generate" method="post">
  35. <label for="vehicle">Choose a vehicle:
  36. <select name="vehicle">
  37. {% for vehicle in get_vehicles()[0] %}
  38. {% if vehicle == get_vehicles()[1] %}
  39. <option value="{{vehicle}}" selected>{{vehicle}}</option>
  40. {% else %}
  41. <option value="{{vehicle}}">{{vehicle}}</option>
  42. {% endif %}
  43. {% endfor %}
  44. </select>
  45. </label>
  46. <p></p>
  47. <label for="board">Choose a board:
  48. <select name="board">
  49. {% for board in get_boards()[0] %}
  50. {% if board == get_boards()[1] %}
  51. <option value="{{board}}" selected>{{board}}</option>
  52. {% else %}
  53. <option value="{{board}}">{{board}}</option>
  54. {% endif %}
  55. {% endfor %}
  56. </select>
  57. </label>
  58. <p></p>
  59. <label for="board">Select Features:
  60. <ul class="collapsibleList">
  61. {% for c in get_build_categories() %}
  62. <li>{{c}}
  63. <ul>
  64. {% for f in get_build_options(c) %}
  65. <li>
  66. {% if f.default == 1 %}
  67. <input onclick='dependencies(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox"
  68. name="{{f.label}}" id="{{f.label}}" value="1" checked>
  69. {% else %}
  70. <input onclick='dependencies(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox"
  71. name="{{f.label}}" id="{{f.label}}" value="1">
  72. {% endif %}
  73. {{f.description}}
  74. </li>
  75. {% endfor %}
  76. </ul>
  77. </li>
  78. {% endfor %}
  79. </ul>
  80. </label>
  81. <br>
  82. <input type="submit" value="Generate">
  83. </form>
  84. </div>
  85. <hr>
  86. <div id="build_status"></div>
  87. <br/>
  88. <script>
  89. CollapsibleLists.apply();
  90. function reload() {
  91. var output = document.getElementById('build_status');
  92. var xhr = new XMLHttpRequest();
  93. xhr.open('GET', "/builds/status.html");
  94. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  95. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  96. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  97. xhr.setRequestHeader("Pragma", "no-cache");
  98. xhr.onload = function () {
  99. if (xhr.status === 200) {
  100. output.innerHTML = xhr.responseText;
  101. }
  102. setTimeout(reload, 5000)
  103. }
  104. xhr.send();
  105. }
  106. function dependencies(cb, f_label, f_dependency1) {
  107. switch (cb.name) {
  108. case f_label:
  109. const f_dependency = f_dependency1.split(",")
  110. var arrayLength = f_dependency.length;
  111. for (var i = 0; i < arrayLength; i++) {
  112. if (document.getElementById(f_dependency[i]).checked == false) {
  113. document.getElementById(f_dependency[i]).checked = cb.checked;
  114. }
  115. }
  116. break;
  117. }
  118. }
  119. </script>
  120. </div>
  121. </body>
  122. <hr>
  123. <footer>Created by Will Piper, <a href=https://github.com/ArduPilot/CustomBuild>Source Code</a>.</footer>
  124. </html>