Ok, it seems to have programmed correctly, though I did have some initially trouble programming through Zadig (got to see the sense of humor of whomever programmed it - as you approach the 5min timeout, the porgram message starts asking how your day was
), but it was my fault for doing it wrong the first time.
Programming CORE2ROS
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
E:\Code\Husarion Projects\Husarion_VSC>set PATH=%PATH%;C:\Users\...\.vscode\HusarionTools\b
in\
E:\Code\Husarion Projects\Husarion_VSC>"C:\Users\...\.vscode\HusarionTools\bin\ninja" flash
[1/2] cmd.exe /C "cd /D "E:\Code\Husarion Proj...5.5\sdk\tools\win\core2-flasher myproject.hex"
Connecting to the Husarion device... OK
Checking settings... OK
Connecting to bootloader... OK
Checking configuration... OK
Erasing device... 4 5 OK
Programming device... OK
Reseting device... OK
==== Summary ====
Time: 29156 ms
Speed: 4.59 KBps (37585 bps)
E:\Code\Husarion Projects\Husarion_VSC>
Running the Configuration Wizard:
Everything ran just fine, and seems to be online. Finally. At least at first (see below).
fun fact: leaving the hCFG switch closed during the setup procedure after getting LR1 and LR2 to begin flashing doesn’t seem to have a negative impact on the setup process. I forgot to turn my DIY rocker switch off until just before I powered the board off.
I reloaded my original project, which was just some of the demo code provided by Husarion for the CORE2ROS, specifically the LED blink code. I am not sure if it was something in here that caused my issues.
#include <cstddef>
#include <cstdint>
#include "hFramework.h"
#include "hCloudClient.h"
void printfOnConsoleInWebIDE()
{
for (;;) {
platform.printf("asd %d\r\n", sys.getRefTime());
sys.delay(1000);
}
}
void cfgHandler()
{
//uncomment if you want to stream video from your project using smartphone
//platform.ui.video.enableTransmission();
platform.ui.loadHtml({Resource::WEBIDE, "/ui.html"});
auto l1 = platform.ui.label("l1");
auto lb_bat = platform.ui.label("lb_bat");
auto l2 = platform.ui.label("l2");
auto b = platform.ui.button("btn1");
}
void onKeyEvent(KeyEventType type, KeyCode code)
{
//press "up key" on your keyboard in your device UI
if (code == KeyCode::Up) {
if (type == KeyEventType::Pressed) {
LED3.on();
} else {
LED3.off();
}
}
}
void onButtonEvent(hId id, ButtonEventType type)
{
static int cnt = 0;
if (id == "btn1") {
UiButton b = platform.ui.button("btn1");
if (type == ButtonEventType::Pressed) {
b.setText("pressed %u", cnt++);
} else {
b.setText("released %u", cnt++);
}
LED1.toggle();
}
}
void hMain()
{
platform.begin(&RPi);
platform.ui.configHandler = cfgHandler;
platform.ui.onKeyEvent = onKeyEvent;
platform.ui.onButtonEvent = onButtonEvent;
platform.ui.setProjectId("@@@PROJECT_ID@@@");
sys.setSysLogDev(&devNull); //turn off sys logs
sys.setLogDev(&Serial); //default console setup - USB Serial
Serial.init(115200); //default baudrate for USB Serial is 460800
sys.taskCreate(printfOnConsoleInWebIDE);
for (;;) {
sys.delay(500);
printf("\r\nuptime %u", (unsigned int)sys.getRefTime()); //print on default console - USB Serial
platform.ui.label("l1").setText("uptime %u", (unsigned int)sys.getRefTime());
platform.ui.label("lb_bat").setText("%f [V]", sys.getSupplyVoltage());
LED2.toggle();
}
}
another fun fact: when you click on the “pressed” button, but drag your mouse off before ‘unclicking’, L2 - the LED associated with the software button “pressed” stays lit. Just something I found interesting.
Trouble Returns
Turning off the CORE2ROS shows it as ‘offline’ in the web IDE after refreshing the webpage. However turning on the CORE2ROS back on brings me back to the dreaded L2 blink.
Maybe it is something with the LED Blink example code that leads to this behavior? Maybe it doesn’t like being shutdown suddenly? But I’m not sure how else to shut it down other than just the power switch?