Skip to content

Commit

Permalink
submit test code - pin visualize and bl0942 dump
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Dec 31, 2024
1 parent 30cada0 commit f80457a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/httpserver/http_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,13 @@ int http_fn_cfg_pins(http_request_t* request) {

http_setup(request, httpMimeTypeHTML);
http_html_start(request, "Pin config");

#if 0
poststr(request, "<script src=\"https://openbekeniot.github.io/webapp/test1.js\"></script>");
//poststr(request, "<script src=\"http://localhost:8080/test1.js\"></script>");
poststr(request, "<script>createBeforeMain();</script>");
#endif

poststr(request, "<p>The first field assigns a role to the given pin. The next field is used to enter channel index (relay index), used to support multiple relays and buttons. ");
poststr(request, "So, first button and first relay should have channel 1, second button and second relay have channel 2, etc.</p>");
poststr(request, "<p>Only for button roles another field will be provided to enter channel to toggle when doing double click. ");
Expand Down
10 changes: 10 additions & 0 deletions src/sim/Controller_BL0942.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ void CControllerBL0942::onDrawn() {
}
checksum ^= 0xFF;
data[BL0942_PACKET_LEN - 1] = checksum;

if (0) {
printf("BL0942 packet: ");
for (i = 0; i < BL0942_PACKET_LEN; i++) {
printf("%02X ", data[i]);
}
printf("\n");
printf("Voltage = %.2f, Current = %.3f, Power = %.2f\n", realVoltage, realCurrent, realPower);
}

for (i = 0; i < BL0942_PACKET_LEN; i++) {
UART_AppendByteToReceiveRingBuffer(data[i]);
}
Expand Down

0 comments on commit f80457a

Please sign in to comment.