Skip to content

Commit

Permalink
add nbk mode & Lua variables for date
Browse files Browse the repository at this point in the history
  • Loading branch information
LKosoj committed May 10, 2024
1 parent bbb8888 commit 08bb3a7
Show file tree
Hide file tree
Showing 13 changed files with 876 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Blynk.ino
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ BLYNK_WRITE(V4) {
sam_command_sync = SAMOVAR_BEER;
} else if (Samovar_Mode == SAMOVAR_BK_MODE && !PowerOn) {
sam_command_sync = SAMOVAR_BK;
} else if (Samovar_Mode == SAMOVAR_NBK_MODE && !PowerOn) {
sam_command_sync = SAMOVAR_NBK;
} else if (Samovar_Mode == SAMOVAR_DISTILLATION_MODE && !PowerOn) {
sam_command_sync = SAMOVAR_DISTILLATION;
} else
Expand Down
2 changes: 2 additions & 0 deletions FS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ String get_prf_name() {
fl = "/dist.prf";
} else if (Samovar_CR_Mode == SAMOVAR_BK_MODE) {
fl = "/bk.prf";
} else if (Samovar_CR_Mode == SAMOVAR_NBK_MODE) {
fl = "/nbk.prf";
} else {
fl = "/rectificat.prf";
}
Expand Down
8 changes: 8 additions & 0 deletions Menu.ino
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@ void menu_get_power() {
set_menu_screen(3);
samovar_reset();
}
} else if (Samovar_Mode == SAMOVAR_NBK_MODE) {
if (!PowerOn) {
set_menu_screen(2);
sam_command_sync = SAMOVAR_NBK;
} else {
set_menu_screen(3);
samovar_reset();
}
} else {
if (!PowerOn) {
set_menu_screen(2);
Expand Down
10 changes: 7 additions & 3 deletions Samovar.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#error This code is designed to run on ESP32 platform, not Arduino nor ESP8266! Please check your Tools->Board setting.
#endif

#define SAMOVAR_VERSION F("6.18")
#define SAMOVAR_VERSION F("6.19")

//#define __SAMOVAR_DEBUG

Expand Down Expand Up @@ -157,6 +157,10 @@ StaticSemaphore_t xSemaphoreBufferAVR;
#define LUA_BK ""
#endif

#ifndef LUA_NBK
#define LUA_NBK ""
#endif

#ifndef LUA_RECT
#define LUA_RECT ""
#endif
Expand Down Expand Up @@ -300,10 +304,10 @@ LiquidMenu main_menu1(lcd);

DNSServer dns;

enum SamovarCommands {SAMOVAR_NONE, SAMOVAR_START, SAMOVAR_POWER, SAMOVAR_RESET, CALIBRATE_START, CALIBRATE_STOP, SAMOVAR_PAUSE, SAMOVAR_CONTINUE, SAMOVAR_SETBODYTEMP, SAMOVAR_DISTILLATION, SAMOVAR_BEER, SAMOVAR_BEER_NEXT, SAMOVAR_BK, SAMOVAR_SELF_TEST, SAMOVAR_DIST_NEXT};
enum SamovarCommands {SAMOVAR_NONE, SAMOVAR_START, SAMOVAR_POWER, SAMOVAR_RESET, CALIBRATE_START, CALIBRATE_STOP, SAMOVAR_PAUSE, SAMOVAR_CONTINUE, SAMOVAR_SETBODYTEMP, SAMOVAR_DISTILLATION, SAMOVAR_BEER, SAMOVAR_BEER_NEXT, SAMOVAR_BK, SAMOVAR_NBK, SAMOVAR_SELF_TEST, SAMOVAR_DIST_NEXT};
volatile SamovarCommands sam_command_sync; // переменная для передачи команд между процессами

enum SAMOVAR_MODE {SAMOVAR_RECTIFICATION_MODE, SAMOVAR_DISTILLATION_MODE, SAMOVAR_BEER_MODE, SAMOVAR_BK_MODE, SAMOVAR_SUVID_MODE, SAMOVAR_LUA_MODE};
enum SAMOVAR_MODE {SAMOVAR_RECTIFICATION_MODE, SAMOVAR_DISTILLATION_MODE, SAMOVAR_BEER_MODE, SAMOVAR_BK_MODE, SAMOVAR_NBK_MODE, SAMOVAR_SUVID_MODE, SAMOVAR_LUA_MODE};
volatile SAMOVAR_MODE Samovar_Mode;
volatile SAMOVAR_MODE Samovar_CR_Mode;

Expand Down
16 changes: 16 additions & 0 deletions Samovar.ino
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ cppQueue msg_q(100, 5, FIFO);
#include "distiller.h"
#include "beer.h"
#include "BK.h"
#include "nbk.h"
#include "SPIFFSEditor.h"

#include "I2CStepper.h"
Expand Down Expand Up @@ -457,6 +458,8 @@ void triggerSysTicker(void *parameter) {
check_alarm_distiller();
} else if (Samovar_Mode == SAMOVAR_BK_MODE) {
check_alarm_bk();
} else if (Samovar_Mode == SAMOVAR_NBK_MODE) {
check_alarm_nbk();
} else if (Samovar_Mode == SAMOVAR_BEER_MODE) {
check_alarm_beer();
WFpulseCount = 100;
Expand Down Expand Up @@ -508,6 +511,8 @@ void triggerSysTicker(void *parameter) {

} else if (Samovar_Mode == SAMOVAR_BK_MODE) {

} else if (Samovar_Mode == SAMOVAR_NBK_MODE) {

}
//Считаем прогресс отбора для текущей строки программы и время до конца завершения строки и всего отбора (режим ректификации)
else if (Samovar_Mode == SAMOVAR_RECTIFICATION_MODE && (TargetStepps > 0 || program[ProgramNum].WType == "P")) {
Expand Down Expand Up @@ -1093,6 +1098,12 @@ void loop() {
sam_command_sync = SAMOVAR_BK;
} else
bk_finish();
} else if (Samovar_Mode == SAMOVAR_NBK_MODE) {
//если дистилляция включаем или выключаем
if (!PowerOn) {
sam_command_sync = SAMOVAR_NBK;
} else
nbk_finish();
} else if (Samovar_Mode == SAMOVAR_BEER_MODE) {
//если пиво включаем или двигаем программу
if (!PowerOn) {
Expand Down Expand Up @@ -1162,6 +1173,11 @@ void loop() {
SamovarStatusInt = 3000;
startval = 3000;
break;
case SAMOVAR_NBK:
Samovar_Mode = SAMOVAR_NBK_MODE;
SamovarStatusInt = 4000;
startval = 4000;
break;
case SAMOVAR_SELF_TEST:
start_self_test();
break;
Expand Down
15 changes: 15 additions & 0 deletions WebServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ void change_samovar_mode() {
server.on("/index.htm", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(SPIFFS, "/bk.htm", String(), false, indexKeyProcessor);
});
} else if (Samovar_Mode == SAMOVAR_NBK_MODE) {
server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(SPIFFS, "/nbk.htm", String(), false, indexKeyProcessor);
});
server.on("/index.htm", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(SPIFFS, "/nbk.htm", String(), false, indexKeyProcessor);
});
} else {
Samovar_Mode = SAMOVAR_RECTIFICATION_MODE;
server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
Expand Down Expand Up @@ -427,6 +434,8 @@ String setupKeyProcessor(const String &var) {
return "selected";
else if (var == "BK" && (SAMOVAR_MODE)SamSetup.Mode == SAMOVAR_BK_MODE)
return "selected";
else if (var == "NBK" && (SAMOVAR_MODE)SamSetup.Mode == SAMOVAR_NBK_MODE)
return "selected";
else if (var == "SUVID" && (SAMOVAR_MODE)SamSetup.Mode == SAMOVAR_SUVID_MODE)
return "selected";
else if (var == "RAL" && !SamSetup.rele1)
Expand Down Expand Up @@ -750,6 +759,10 @@ void web_command(AsyncWebServerRequest *request) {
if (!PowerOn) sam_command_sync = SAMOVAR_BK;
else
sam_command_sync = SAMOVAR_POWER;
} else if (Samovar_Mode == SAMOVAR_NBK_MODE) {
if (!PowerOn) sam_command_sync = SAMOVAR_NBK;
else
sam_command_sync = SAMOVAR_POWER;
} else
sam_command_sync = SAMOVAR_POWER;
} else if (request->hasArg("setbodytemp")) {
Expand Down Expand Up @@ -909,6 +922,7 @@ void get_web_interface() {

s += get_web_file("beer.htm", SAVE_FILE_OVERRIDE);
s += get_web_file("bk.htm", SAVE_FILE_OVERRIDE);
s += get_web_file("nbk.htm", SAVE_FILE_OVERRIDE);
s += get_web_file("brewxml.htm", SAVE_FILE_OVERRIDE);
s += get_web_file("calibrate.htm", SAVE_FILE_OVERRIDE);
s += get_web_file("chart.htm", SAVE_FILE_OVERRIDE);
Expand All @@ -920,6 +934,7 @@ void get_web_interface() {

s += get_web_file("beer.lua", SAVE_FILE_IF_NOT_EXIST);
s += get_web_file("bk.lua", SAVE_FILE_IF_NOT_EXIST);
s += get_web_file("nbk.lua", SAVE_FILE_IF_NOT_EXIST);
s += get_web_file("btn_button1.lua", SAVE_FILE_IF_NOT_EXIST);
s += get_web_file("btn_button2.lua", SAVE_FILE_IF_NOT_EXIST);
s += get_web_file("dist.lua", SAVE_FILE_IF_NOT_EXIST);
Expand Down
Loading

0 comments on commit 08bb3a7

Please sign in to comment.