| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -39,6 +39,7 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "index.hpp" | 
					 | 
					 | 
					 | 
					#include "index.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "lua_thread.hpp" | 
					 | 
					 | 
					 | 
					#include "lua_thread.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "memory_resource.hpp" | 
					 | 
					 | 
					 | 
					#include "memory_resource.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#include "samd.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "service_locator.hpp" | 
					 | 
					 | 
					 | 
					#include "service_locator.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "system_events.hpp" | 
					 | 
					 | 
					 | 
					#include "system_events.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "track.hpp" | 
					 | 
					 | 
					 | 
					#include "track.hpp" | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -414,14 +415,15 @@ int CmdSamd(int argc, char** argv) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    std::cout << usage << std::endl; | 
					 | 
					 | 
					 | 
					    std::cout << usage << std::endl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return 1; | 
					 | 
					 | 
					 | 
					    return 1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  drivers::Samd& samd = AppConsole::sServices->samd(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  std::pmr::string cmd{argv[1]}; | 
					 | 
					 | 
					 | 
					  std::pmr::string cmd{argv[1]}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (cmd == "flash") { | 
					 | 
					 | 
					 | 
					  if (cmd == "flash") { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    std::cout << "resetting samd..." << std::endl; | 
					 | 
					 | 
					 | 
					    std::cout << "resetting samd..." << std::endl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vTaskDelay(pdMS_TO_TICKS(5)); | 
					 | 
					 | 
					 | 
					    vTaskDelay(pdMS_TO_TICKS(5)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    AppConsole::sServices->samd().ResetToFlashSamd(); | 
					 | 
					 | 
					 | 
					    samd.ResetToFlashSamd(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else if (cmd == "charge") { | 
					 | 
					 | 
					 | 
					  } else if (cmd == "charge") { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    auto res = AppConsole::sServices->samd().GetChargeStatus(); | 
					 | 
					 | 
					 | 
					    auto res = samd.GetChargeStatus(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (res) { | 
					 | 
					 | 
					 | 
					    if (res) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      switch (res.value()) { | 
					 | 
					 | 
					 | 
					      switch (res.value()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        case drivers::Samd::ChargeStatus::kNoBattery: | 
					 | 
					 | 
					 | 
					        case drivers::Samd::ChargeStatus::kNoBattery: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -446,6 +448,10 @@ int CmdSamd(int argc, char** argv) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else { | 
					 | 
					 | 
					 | 
					    } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      std::cout << "unknown" << std::endl; | 
					 | 
					 | 
					 | 
					      std::cout << "unknown" << std::endl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } else if (cmd == "msc") { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    bool current = samd.UsbMassStorage(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    std::cout << "toggling to: " << !current << std::endl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    samd.UsbMassStorage(!current); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else if (cmd == "off") { | 
					 | 
					 | 
					 | 
					  } else if (cmd == "off") { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    std::cout << "bye !!!" << std::endl; | 
					 | 
					 | 
					 | 
					    std::cout << "bye !!!" << std::endl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vTaskDelay(pdMS_TO_TICKS(5)); | 
					 | 
					 | 
					 | 
					    vTaskDelay(pdMS_TO_TICKS(5)); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |