app.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. from flask import Flask, request, jsonify, render_template
  2. import os
  3. import serial
  4. import time
  5. import random
  6. import threading
  7. import serial.tools.list_ports
  8. import math
  9. import json
  10. app = Flask(__name__)
  11. # Configuration
  12. THETA_RHO_DIR = './patterns'
  13. IGNORE_PORTS = ['/dev/cu.debug-console', '/dev/cu.Bluetooth-Incoming-Port']
  14. CLEAR_PATTERNS = {
  15. "clear_from_in": "./patterns/clear_from_in.thr",
  16. "clear_from_out": "./patterns/clear_from_out.thr",
  17. "clear_sideway": "./patterns/clear_sideway.thr"
  18. }
  19. os.makedirs(THETA_RHO_DIR, exist_ok=True)
  20. # Serial connection (First available will be selected by default)
  21. ser = None
  22. ser_port = None # Global variable to store the serial port name
  23. stop_requested = False
  24. serial_lock = threading.Lock()
  25. PLAYLISTS_FILE = os.path.join(os.getcwd(), "playlists.json")
  26. # Ensure the file exists and contains at least an empty JSON object
  27. if not os.path.exists(PLAYLISTS_FILE):
  28. with open(PLAYLISTS_FILE, "w") as f:
  29. json.dump({}, f, indent=2)
  30. def list_serial_ports():
  31. """Return a list of available serial ports."""
  32. ports = serial.tools.list_ports.comports()
  33. return [port.device for port in ports if port.device not in IGNORE_PORTS]
  34. def connect_to_serial(port=None, baudrate=115200):
  35. """Automatically connect to the first available serial port or a specified port."""
  36. global ser, ser_port
  37. try:
  38. if port is None:
  39. ports = list_serial_ports()
  40. if not ports:
  41. print("No serial port connected")
  42. return False
  43. port = ports[0] # Auto-select the first available port
  44. with serial_lock:
  45. if ser and ser.is_open:
  46. ser.close()
  47. ser = serial.Serial(port, baudrate)
  48. ser_port = port # Store the connected port globally
  49. print(f"Connected to serial port: {port}")
  50. time.sleep(2) # Allow time for the connection to establish
  51. return True # Successfully connected
  52. except serial.SerialException as e:
  53. print(f"Failed to connect to serial port {port}: {e}")
  54. port = None # Reset the port to try the next available one
  55. print("Max retries reached. Could not connect to a serial port.")
  56. return False
  57. def disconnect_serial():
  58. """Disconnect the current serial connection."""
  59. global ser, ser_port
  60. if ser and ser.is_open:
  61. ser.close()
  62. ser = None
  63. ser_port = None # Reset the port name
  64. def restart_serial(port, baudrate=115200):
  65. """Restart the serial connection."""
  66. disconnect_serial()
  67. connect_to_serial(port, baudrate)
  68. def parse_theta_rho_file(file_path):
  69. """
  70. Parse a theta-rho file and return a list of (theta, rho) pairs.
  71. Normalizes the list so the first theta is always 0.
  72. """
  73. coordinates = []
  74. try:
  75. with open(file_path, 'r') as file:
  76. for line in file:
  77. line = line.strip()
  78. # Skip header or comment lines (starting with '#' or empty lines)
  79. if not line or line.startswith("#"):
  80. continue
  81. # Parse lines with theta and rho separated by spaces
  82. try:
  83. theta, rho = map(float, line.split())
  84. coordinates.append((theta, rho))
  85. except ValueError:
  86. print(f"Skipping invalid line: {line}")
  87. continue
  88. except Exception as e:
  89. print(f"Error reading file: {e}")
  90. return coordinates
  91. # ---- Normalization Step ----
  92. if coordinates:
  93. # Take the first coordinate's theta
  94. first_theta = coordinates[0][0]
  95. # Shift all thetas so the first coordinate has theta=0
  96. normalized = []
  97. for (theta, rho) in coordinates:
  98. if rho > 1:
  99. rho = 1
  100. elif rho < 0:
  101. rho = 0
  102. normalized.append((theta - first_theta, rho))
  103. # Replace original list with normalized data
  104. coordinates = normalized
  105. return coordinates
  106. def send_coordinate_batch(ser, coordinates):
  107. """Send a batch of theta-rho pairs to the Arduino."""
  108. # print("Sending batch:", coordinates)
  109. batch_str = ";".join(f"{theta:.5f},{rho:.5f}" for theta, rho in coordinates) + ";\n"
  110. ser.write(batch_str.encode())
  111. def send_command(command):
  112. """Send a single command to the Arduino."""
  113. ser.write(f"{command}\n".encode())
  114. print(f"Sent: {command}")
  115. # Wait for "DONE" acknowledgment from Arduino
  116. while True:
  117. with serial_lock:
  118. if ser.in_waiting > 0:
  119. response = ser.readline().decode().strip()
  120. print(f"Arduino response: {response}")
  121. if response == "DONE":
  122. print("Command execution completed.")
  123. break
  124. def run_theta_rho_file(file_path):
  125. """Run a theta-rho file by sending data in optimized batches."""
  126. global stop_requested
  127. stop_requested = False
  128. coordinates = parse_theta_rho_file(file_path)
  129. if len(coordinates) < 2:
  130. print("Not enough coordinates for interpolation.")
  131. return
  132. # Optimize batch size for smoother execution
  133. batch_size = 10 # Smaller batches may smooth movement further
  134. for i in range(0, len(coordinates), batch_size):
  135. # Check stop_requested flag after sending the batch
  136. if stop_requested:
  137. print("Execution stopped by user after completing the current batch.")
  138. break
  139. batch = coordinates[i:i + batch_size]
  140. if i == 0:
  141. send_coordinate_batch(ser, batch)
  142. continue
  143. # Wait until Arduino is READY before sending the batch
  144. while True:
  145. with serial_lock:
  146. if ser.in_waiting > 0:
  147. response = ser.readline().decode().strip()
  148. if response == "R":
  149. send_coordinate_batch(ser, batch)
  150. break
  151. else:
  152. print(f"Arduino response: {response}")
  153. # Reset theta after execution or stopping
  154. reset_theta()
  155. ser.write("FINISHED\n".encode())
  156. def get_clear_pattern_file(pattern_name):
  157. """Return a .thr file path based on pattern_name."""
  158. if pattern_name == "random":
  159. # Randomly pick one of the three known patterns
  160. return random.choice(list(CLEAR_PATTERNS.values()))
  161. # If pattern_name is invalid or absent, default to 'clear_from_in'
  162. return CLEAR_PATTERNS.get(pattern_name, CLEAR_PATTERNS["clear_from_in"])
  163. def run_theta_rho_files(
  164. file_paths,
  165. pause_time=0,
  166. clear_pattern=None
  167. ):
  168. """
  169. Runs multiple .thr files in sequence, optionally pausing between each pattern,
  170. and optionally running a clear pattern between files.
  171. Now supports:
  172. - no_clear: skips running a clear pattern
  173. - random: chooses any of the 3 clear patterns randomly
  174. """
  175. global stop_requested
  176. stop_requested = False # reset stop flag at the start
  177. for idx, path in enumerate(file_paths):
  178. if stop_requested:
  179. print("Execution stopped before starting next pattern.")
  180. break
  181. # Run the main pattern
  182. print(f"Running pattern {idx + 1} of {len(file_paths)}: {path}")
  183. run_theta_rho_file(path)
  184. # If there are more files to run
  185. if idx < len(file_paths) - 1:
  186. # Pause after each pattern if requested
  187. time.sleep(pause_time)
  188. if stop_requested:
  189. print("Execution stopped before running the next pattern or clear.")
  190. break
  191. if not clear_pattern:
  192. continue
  193. # Otherwise, get the file (could be random or a known pattern)
  194. clear_file_path = get_clear_pattern_file(clear_pattern)
  195. print(f"Running clear pattern: {clear_file_path}")
  196. run_theta_rho_file(clear_file_path)
  197. print("All requested patterns completed (or stopped).")
  198. def reset_theta():
  199. """Reset theta on the Arduino."""
  200. ser.write("RESET_THETA\n".encode())
  201. while True:
  202. with serial_lock:
  203. if ser.in_waiting > 0:
  204. response = ser.readline().decode().strip()
  205. print(f"Arduino response: {response}")
  206. if response == "THETA_RESET":
  207. print("Theta successfully reset.")
  208. break
  209. time.sleep(0.5) # Small delay to avoid busy waiting
  210. # Flask API Endpoints
  211. @app.route('/')
  212. def index():
  213. return render_template('index.html')
  214. @app.route('/list_serial_ports', methods=['GET'])
  215. def list_ports():
  216. return jsonify(list_serial_ports())
  217. @app.route('/connect_serial', methods=['POST'])
  218. def connect_serial():
  219. port = request.json.get('port')
  220. if not port:
  221. return jsonify({'error': 'No port provided'}), 400
  222. try:
  223. connect_to_serial(port)
  224. return jsonify({'success': True})
  225. except Exception as e:
  226. return jsonify({'error': str(e)}), 500
  227. @app.route('/disconnect_serial', methods=['POST'])
  228. def disconnect():
  229. try:
  230. disconnect_serial()
  231. return jsonify({'success': True})
  232. except Exception as e:
  233. return jsonify({'error': str(e)}), 500
  234. @app.route('/restart_serial', methods=['POST'])
  235. def restart():
  236. port = request.json.get('port')
  237. if not port:
  238. return jsonify({'error': 'No port provided'}), 400
  239. try:
  240. restart_serial(port)
  241. return jsonify({'success': True})
  242. except Exception as e:
  243. return jsonify({'error': str(e)}), 500
  244. @app.route('/list_theta_rho_files', methods=['GET'])
  245. def list_theta_rho_files():
  246. files = []
  247. for root, _, filenames in os.walk(THETA_RHO_DIR):
  248. for file in filenames:
  249. # Construct the relative file path
  250. relative_path = os.path.relpath(os.path.join(root, file), THETA_RHO_DIR)
  251. files.append(relative_path)
  252. return jsonify(sorted(files))
  253. @app.route('/upload_theta_rho', methods=['POST'])
  254. def upload_theta_rho():
  255. custom_patterns_dir = os.path.join(THETA_RHO_DIR, 'custom_patterns')
  256. os.makedirs(custom_patterns_dir, exist_ok=True) # Ensure the directory exists
  257. file = request.files['file']
  258. if file:
  259. file.save(os.path.join(custom_patterns_dir, file.filename))
  260. return jsonify({'success': True})
  261. return jsonify({'success': False})
  262. @app.route('/run_theta_rho', methods=['POST'])
  263. def run_theta_rho():
  264. file_name = request.json.get('file_name')
  265. pre_execution = request.json.get('pre_execution') # 'clear_in', 'clear_out', or 'none'
  266. if not file_name:
  267. return jsonify({'error': 'No file name provided'}), 400
  268. file_path = os.path.join(THETA_RHO_DIR, file_name)
  269. if not os.path.exists(file_path):
  270. return jsonify({'error': 'File not found'}), 404
  271. try:
  272. # Build a list of files to run in sequence
  273. files_to_run = []
  274. if pre_execution == 'clear_in':
  275. files_to_run.append('./patterns/clear_from_in.thr')
  276. elif pre_execution == 'clear_out':
  277. files_to_run.append('./patterns/clear_from_out.thr')
  278. elif pre_execution == 'clear_sideway':
  279. files_to_run.append('./patterns/clear_sideway.thr')
  280. elif pre_execution == 'none':
  281. pass # No pre-execution action required
  282. # Finally, add the main file
  283. files_to_run.append(file_path)
  284. # Run them in one shot using run_theta_rho_files (blocking call)
  285. threading.Thread(
  286. target=run_theta_rho_files,
  287. args=(files_to_run,),
  288. kwargs={
  289. 'pause_time': 0,
  290. 'clear_pattern': None
  291. }
  292. ).start()
  293. return jsonify({'success': True})
  294. except Exception as e:
  295. return jsonify({'error': str(e)}), 500
  296. @app.route('/stop_execution', methods=['POST'])
  297. def stop_execution():
  298. global stop_requested
  299. stop_requested = True
  300. return jsonify({'success': True})
  301. @app.route('/send_home', methods=['POST'])
  302. def send_home():
  303. """Send the HOME command to the Arduino."""
  304. try:
  305. send_command("HOME")
  306. return jsonify({'success': True})
  307. except Exception as e:
  308. return jsonify({'error': str(e)}), 500
  309. @app.route('/run_theta_rho_file/<file_name>', methods=['POST'])
  310. def run_specific_theta_rho_file(file_name):
  311. """Run a specific theta-rho file."""
  312. file_path = os.path.join(THETA_RHO_DIR, file_name)
  313. if not os.path.exists(file_path):
  314. return jsonify({'error': 'File not found'}), 404
  315. threading.Thread(target=run_theta_rho_file, args=(file_path,)).start()
  316. return jsonify({'success': True})
  317. @app.route('/delete_theta_rho_file', methods=['POST'])
  318. def delete_theta_rho_file():
  319. data = request.json
  320. file_name = data.get('file_name')
  321. if not file_name:
  322. return jsonify({"success": False, "error": "No file name provided"}), 400
  323. file_path = os.path.join(THETA_RHO_DIR, file_name)
  324. if not os.path.exists(file_path):
  325. return jsonify({"success": False, "error": "File not found"}), 404
  326. try:
  327. os.remove(file_path)
  328. return jsonify({"success": True})
  329. except Exception as e:
  330. return jsonify({"success": False, "error": str(e)}), 500
  331. @app.route('/move_to_center', methods=['POST'])
  332. def move_to_center():
  333. """Move the sand table to the center position."""
  334. try:
  335. if ser is None or not ser.is_open:
  336. return jsonify({"success": False, "error": "Serial connection not established"}), 400
  337. coordinates = [(0, 0)] # Center position
  338. send_coordinate_batch(ser, coordinates)
  339. return jsonify({"success": True})
  340. except Exception as e:
  341. return jsonify({"success": False, "error": str(e)}), 500
  342. @app.route('/move_to_perimeter', methods=['POST'])
  343. def move_to_perimeter():
  344. """Move the sand table to the perimeter position."""
  345. try:
  346. if ser is None or not ser.is_open:
  347. return jsonify({"success": False, "error": "Serial connection not established"}), 400
  348. MAX_RHO = 1
  349. coordinates = [(0, MAX_RHO)] # Perimeter position
  350. send_coordinate_batch(ser, coordinates)
  351. return jsonify({"success": True})
  352. except Exception as e:
  353. return jsonify({"success": False, "error": str(e)}), 500
  354. @app.route('/preview_thr', methods=['POST'])
  355. def preview_thr():
  356. file_name = request.json.get('file_name')
  357. if not file_name:
  358. return jsonify({'error': 'No file name provided'}), 400
  359. file_path = os.path.join(THETA_RHO_DIR, file_name)
  360. if not os.path.exists(file_path):
  361. return jsonify({'error': 'File not found'}), 404
  362. try:
  363. # Parse the .thr file with transformations
  364. coordinates = parse_theta_rho_file(file_path)
  365. return jsonify({'success': True, 'coordinates': coordinates})
  366. except Exception as e:
  367. return jsonify({'error': str(e)}), 500
  368. @app.route('/send_coordinate', methods=['POST'])
  369. def send_coordinate():
  370. """Send a single (theta, rho) coordinate to the Arduino."""
  371. global ser
  372. if ser is None or not ser.is_open:
  373. return jsonify({"success": False, "error": "Serial connection not established"}), 400
  374. try:
  375. data = request.json
  376. theta = data.get('theta')
  377. rho = data.get('rho')
  378. if theta is None or rho is None:
  379. return jsonify({"success": False, "error": "Theta and Rho are required"}), 400
  380. # Send the coordinate to the Arduino
  381. send_coordinate_batch(ser, [(theta, rho)])
  382. reset_theta()
  383. return jsonify({"success": True})
  384. except Exception as e:
  385. return jsonify({"success": False, "error": str(e)}), 500
  386. # Expose files for download if needed
  387. @app.route('/download/<filename>', methods=['GET'])
  388. def download_file(filename):
  389. """Download a file from the theta-rho directory."""
  390. return send_from_directory(THETA_RHO_DIR, filename)
  391. @app.route('/serial_status', methods=['GET'])
  392. def serial_status():
  393. global ser, ser_port
  394. return jsonify({
  395. 'connected': ser.is_open if ser else False,
  396. 'port': ser_port # Include the port name
  397. })
  398. if not os.path.exists(PLAYLISTS_FILE):
  399. with open(PLAYLISTS_FILE, "w") as f:
  400. json.dump({}, f, indent=2)
  401. def load_playlists():
  402. """
  403. Load the entire playlists dictionary from the JSON file.
  404. Returns something like: {
  405. "My Playlist": ["file1.thr", "file2.thr"],
  406. "Another": ["x.thr"]
  407. }
  408. """
  409. with open(PLAYLISTS_FILE, "r") as f:
  410. return json.load(f)
  411. def save_playlists(playlists_dict):
  412. """
  413. Save the entire playlists dictionary back to the JSON file.
  414. """
  415. with open(PLAYLISTS_FILE, "w") as f:
  416. json.dump(playlists_dict, f, indent=2)
  417. @app.route("/list_all_playlists", methods=["GET"])
  418. def list_all_playlists():
  419. """
  420. Returns a list of all playlist names.
  421. Example return: ["My Playlist", "Another Playlist"]
  422. """
  423. playlists_dict = load_playlists()
  424. playlist_names = list(playlists_dict.keys())
  425. return jsonify(playlist_names)
  426. @app.route("/get_playlist", methods=["GET"])
  427. def get_playlist():
  428. """
  429. GET /get_playlist?name=My%20Playlist
  430. Returns: { "name": "My Playlist", "files": [... ] }
  431. """
  432. playlist_name = request.args.get("name", "")
  433. if not playlist_name:
  434. return jsonify({"error": "Missing playlist 'name' parameter"}), 400
  435. playlists_dict = load_playlists()
  436. if playlist_name not in playlists_dict:
  437. return jsonify({"error": f"Playlist '{playlist_name}' not found"}), 404
  438. files = playlists_dict[playlist_name] # e.g. ["file1.thr", "file2.thr"]
  439. return jsonify({
  440. "name": playlist_name,
  441. "files": files
  442. })
  443. @app.route("/create_playlist", methods=["POST"])
  444. def create_playlist():
  445. """
  446. POST /create_playlist
  447. Body: { "name": "My Playlist", "files": ["file1.thr", "file2.thr"] }
  448. Creates or overwrites a playlist with the given name.
  449. """
  450. data = request.get_json()
  451. if not data or "name" not in data or "files" not in data:
  452. return jsonify({"success": False, "error": "Playlist 'name' and 'files' are required"}), 400
  453. playlist_name = data["name"]
  454. files = data["files"]
  455. # Load all playlists
  456. playlists_dict = load_playlists()
  457. # Overwrite or create new
  458. playlists_dict[playlist_name] = files
  459. # Save changes
  460. save_playlists(playlists_dict)
  461. return jsonify({
  462. "success": True,
  463. "message": f"Playlist '{playlist_name}' created/updated"
  464. })
  465. @app.route("/modify_playlist", methods=["POST"])
  466. def modify_playlist():
  467. """
  468. POST /modify_playlist
  469. Body: { "name": "My Playlist", "files": ["file1.thr", "file2.thr"] }
  470. Updates (or creates) the existing playlist with a new file list.
  471. You can 404 if you only want to allow modifications to existing playlists.
  472. """
  473. data = request.get_json()
  474. if not data or "name" not in data or "files" not in data:
  475. return jsonify({"success": False, "error": "Playlist 'name' and 'files' are required"}), 400
  476. playlist_name = data["name"]
  477. files = data["files"]
  478. # Load all playlists
  479. playlists_dict = load_playlists()
  480. # Optional: If you want to disallow creating a new playlist here:
  481. # if playlist_name not in playlists_dict:
  482. # return jsonify({"success": False, "error": f"Playlist '{playlist_name}' not found"}), 404
  483. # Overwrite or create new
  484. playlists_dict[playlist_name] = files
  485. # Save
  486. save_playlists(playlists_dict)
  487. return jsonify({"success": True, "message": f"Playlist '{playlist_name}' updated"})
  488. @app.route("/delete_playlist", methods=["DELETE"])
  489. def delete_playlist():
  490. """
  491. DELETE /delete_playlist
  492. Body: { "name": "My Playlist" }
  493. Removes the playlist from the single JSON file.
  494. """
  495. data = request.get_json()
  496. if not data or "name" not in data:
  497. return jsonify({"success": False, "error": "Missing 'name' field"}), 400
  498. playlist_name = data["name"]
  499. playlists_dict = load_playlists()
  500. if playlist_name not in playlists_dict:
  501. return jsonify({"success": False, "error": f"Playlist '{playlist_name}' not found"}), 404
  502. # Remove from dict
  503. del playlists_dict[playlist_name]
  504. save_playlists(playlists_dict)
  505. return jsonify({
  506. "success": True,
  507. "message": f"Playlist '{playlist_name}' deleted"
  508. })
  509. @app.route("/run_playlist", methods=["POST"])
  510. def run_playlist():
  511. """
  512. POST /run_playlist
  513. Body (JSON):
  514. {
  515. "playlist_name": "My Playlist",
  516. "pause_time": 1.0, # Optional: seconds to pause between patterns
  517. "clear_pattern": "random" # Optional: "clear_in", "clear_out", "clear_sideway", or "random"
  518. }
  519. """
  520. data = request.get_json()
  521. # Validate input
  522. if not data or "playlist_name" not in data:
  523. return jsonify({"success": False, "error": "Missing 'playlist_name' field"}), 400
  524. playlist_name = data["playlist_name"]
  525. pause_time = data.get("pause_time", 0)
  526. clear_pattern = data.get("clear_pattern", None)
  527. # Validate pause_time
  528. if not isinstance(pause_time, (int, float)) or pause_time < 0:
  529. return jsonify({"success": False, "error": "'pause_time' must be a non-negative number"}), 400
  530. valid_patterns = ["clear_in", "clear_out", "clear_sideway", "random"]
  531. if clear_pattern not in valid_patterns and clear_pattern is not None:
  532. return jsonify({"success": False, "error": f"'clear_pattern' must be one of {valid_patterns} or null"}), 400
  533. # Load playlists
  534. playlists = load_playlists()
  535. if playlist_name not in playlists:
  536. return jsonify({"success": False, "error": f"Playlist '{playlist_name}' not found"}), 404
  537. file_paths = playlists[playlist_name]
  538. file_paths = [os.path.join(THETA_RHO_DIR, file) for file in file_paths]
  539. if not file_paths:
  540. return jsonify({"success": False, "error": f"Playlist '{playlist_name}' is empty"}), 400
  541. # Start the playlist execution in a separate thread
  542. try:
  543. threading.Thread(
  544. target=run_theta_rho_files,
  545. args=(file_paths,),
  546. kwargs={
  547. 'pause_time': pause_time,
  548. 'clear_pattern': clear_pattern
  549. },
  550. daemon=True # Daemonize thread to exit with the main program
  551. ).start()
  552. return jsonify({"success": True, "message": f"Playlist '{playlist_name}' is now running."})
  553. except Exception as e:
  554. return jsonify({"success": False, "error": str(e)}), 500
  555. if __name__ == '__main__':
  556. app.run(debug=True, host='0.0.0.0', port=8080)