Skip to content

Commit

Permalink
Final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
connornishijima committed Apr 6, 2024
1 parent 432806a commit 2c7813b
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 10 deletions.
10 changes: 5 additions & 5 deletions data/js/spin_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ function setup_landscape_listener() {
dimmer.style.left = '0';
dimmer.style.width = '100%';
dimmer.style.height = '100%';
dimmer.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
dimmer.style.backgroundColor = 'rgba(0, 0, 0, 1.0)';
dimmer.style.display = 'flex';
dimmer.style.alignItems = 'center';
dimmer.style.justifyContent = 'center';
dimmer.style.fontSize = '5em';
dimmer.style.fontSize = '1.5em';
dimmer.style.transition = 'opacity 500ms';
dimmer.style.visibility = 'hidden';
dimmer.style.opacity = '0';
dimmer.style.color = 'var(--accent)';
dimmer.innerHTML = ':(';
dimmer.innerHTML = 'Sorry, portrait mode only!';
document.body.appendChild(dimmer);

// Add event listener for window resize
window.addEventListener('resize', () => {
//toggle_dimmer(is_landscape());
toggle_dimmer(is_landscape());
});

// Initial check in case the page loads in landscape mode
//toggle_dimmer(is_landscape());
toggle_dimmer(is_landscape());
}

// Initialize the listener on page load
Expand Down
6 changes: 6 additions & 0 deletions data/js/websockets_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ function parse_message(message){
}
);
}
else if(command_type == "version"){
let version = command_data[1];
document.getElementById("version_number").innerHTML = "Version: "+version;
}
else{
console.log(`Unrecognized command type: ${command_type}`);
}
Expand Down Expand Up @@ -432,6 +436,8 @@ function open_websockets_connection_to_device(){
ws.onopen = function(e) {
console.log("[open] Connection established");
connection_pending = false;

transmit("get|version");
};

ws.onmessage = function(event) {
Expand Down
5 changes: 5 additions & 0 deletions data/remote.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@
MAC: LOADING...
</div>
</div>
<div class="menu_item buzz">
<div id="version_number">
VERSION: LOADING...
</div>
</div>
</div>

<div id="menu_stats">
Expand Down
3 changes: 1 addition & 2 deletions src/EMOTISCOPE_FIRMWARE.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ############################################################################
// ## SOFTWARE VERSION ########################################################

#define SOFTWARE_VERSION_MAJOR ( 0 )
#define SOFTWARE_VERSION_MAJOR ( 1 )
#define SOFTWARE_VERSION_MINOR ( 0 )
#define SOFTWARE_VERSION_PATCH ( 0 )

Expand Down Expand Up @@ -55,7 +55,6 @@
#include "audio_debug.h" // ........ Print audio data over UART
#include "screensaver.h" // ........ Colorful dots play on screen when no audio is present
#include "standby.h" // ............ Handles sleep/wake + animations
//#include "neural.h" // ............. Neural network for notation classification
#include "lightshow_modes.h" // .... Definition and handling of lightshow modes
#include "commands.h" // ........... Queuing and parsing of commands recieved
#include "wireless.h" // ........... Communication with your network and the web-app
Expand Down
84 changes: 84 additions & 0 deletions src/EMOTISCOPE_FIRMWARE.ino.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 1 "C:\\Users\\conno\\AppData\\Local\\Temp\\tmpeghszhws"
#include <Arduino.h>
# 1 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
# 14 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
#define SOFTWARE_VERSION_MAJOR ( 1 )
#define SOFTWARE_VERSION_MINOR ( 0 )
#define SOFTWARE_VERSION_PATCH ( 0 )






#include <PsychicHttp.h>
#include <HTTPClient.h>
#include <ESPmDNS.h>
#include <Ticker.h>
#include <DNSServer.h>
#include <Preferences.h>
#include <Update.h>
#include <WiFi.h>
#include <esp_dsp.h>
#include <esp_wifi.h>


#include "global_defines.h"
#include "hardware_version.h"
#include "types.h"
#include "profiler.h"
#include "sliders.h"
#include "toggles.h"
#include "menu_toggles.h"
#include "filesystem.h"
#include "configuration.h"
#include "utilities.h"
#include "system.h"
#include "led_driver.h"
#include "leds.h"
#include "touch.h"
#include "indicator.h"
#include "ui.h"
#include "microphone.h"
#include "vu.h"
#include "goertzel.h"
#include "tempo.h"
#include "audio_debug.h"
#include "screensaver.h"
#include "standby.h"
#include "lightshow_modes.h"
#include "commands.h"
#include "wireless.h"
#include "ota.h"


#include "cpu_core.h"
#include "gpu_core.h"
#include "web_core.h"


#include "notes.h"
void loop();
void loop_gpu(void *param);
void setup();
#line 75 "C:/Users/conno/Emotiscope/src/EMOTISCOPE_FIRMWARE.ino"
void loop() {
run_cpu();
run_web();
}


void loop_gpu(void *param) {
for (;;) {
run_gpu();
}
}


void setup() {

init_system();


(void)xTaskCreatePinnedToCore(loop_gpu, "loop_gpu", 8192, NULL, 0, NULL, 0);
}
7 changes: 7 additions & 0 deletions src/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ void parse_command(uint32_t t_now_ms, command com) {
transmit_to_client_in_slot(command_string, com.origin_client_slot);
}

// If getting version number
else if (fastcmp(substring, "version")) {
char command_string[80];
snprintf(command_string, 80, "version|%d.%d.%d", SOFTWARE_VERSION_MAJOR, SOFTWARE_VERSION_MINOR, SOFTWARE_VERSION_PATCH);
transmit_to_client_in_slot(command_string, com.origin_client_slot);
}

// Couldn't figure out what to "get"
else{
unrecognized_command_error(substring);
Expand Down
6 changes: 3 additions & 3 deletions src/vu.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void run_vu(){
max_amplitude_now = clip_float(max_amplitude_now - configuration.vu_floor);
}
else{ // Calibrating
configuration.vu_floor = max(configuration.vu_floor, max_amplitude_now/2.0);
configuration.vu_floor = max(float(configuration.vu_floor), float(max_amplitude_now/2.0));
}

if(max_amplitude_now > max_amplitude_cap){
Expand All @@ -39,8 +39,8 @@ void run_vu(){
}
max_amplitude_cap = clip_float(max_amplitude_cap);

if(max_amplitude_cap < 0.0005){
max_amplitude_cap = 0.0005;
if(max_amplitude_cap < 0.005){
max_amplitude_cap = 0.005;
}

float auto_scale = 1.0 / max(max_amplitude_cap, 0.00001f);
Expand Down

0 comments on commit 2c7813b

Please sign in to comment.