Skip to content

Commit

Permalink
Muda o formato das mensagens no log
Browse files Browse the repository at this point in the history
O formato agora é: [Hora-atual] Mensagem de erro
  • Loading branch information
eaneto committed Jan 28, 2019
1 parent 8e14e2d commit e26873f
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function ConnectTelescope()
try {
sky6RASCOMTele.Connect();
} catch (connerr) {
WriteLog("Erro de conexao com a montagem\n" + connerr.message + " ");
WriteLog("Erro de conexao com a montagem. " + connerr.message);
return false;
}

Expand Down Expand Up @@ -112,7 +112,7 @@ function SlewTelescopeToRaDec(dRa, dDec, targetObject)
sky6RASCOMTele.SlewToRaDec(dRa, dDec, targetObject);
return true;
} catch (slewerr) {
WriteLog("Falha durante o slew\n" + slewerr.message);
WriteLog("Falha durante o slew. " + slewerr.message);
return false;
}
}
Expand All @@ -137,7 +137,7 @@ function SlewTelescopeToAzAlt(az, alt, targetObject)
sky6RASCOMTele.SlewToAzAlt(az, alt, targetObject);
return true;
} catch (slewerr) {
WriteLog("Falha durante o slew\n" + slewerr.message);
WriteLog("Falha durante o slew. " + slewerr.message);
return false;
}
}
Expand All @@ -155,7 +155,7 @@ function ParkTelescope()

if (sky6RASCOMTele.IsParked != 0) {
sky6RASCOMTele.Park();
WriteLog("Parking finalizado as");
WriteLog("Parking finalizado");
return true;
}
}
Expand All @@ -177,7 +177,7 @@ function GetRADec(object)
try {
sky6StarChart.Find(object);
} catch (finderr) {
WriteLog("Erro durante o find.\n" + finderr.message + " ");
WriteLog("Erro durante o find. " + finderr.message);
return false;
}

Expand Down Expand Up @@ -304,8 +304,9 @@ function WriteLog(text)
try {
TextFile.openForAppend(filename);
var formattedTime = getFormattedTime();
TextFile.write(text + " " + formattedTime + "\n");
print(text + " " + formattedTime);
TextFile.write("[" + formattedTime + "] ")
TextFile.write(text + "\n");
print("[" + formattedTime + "] " + text);
TextFile.close();
} catch (texterr) {
PrintAndOut("Erro ao editar o log.\n" + texterr.message);
Expand Down Expand Up @@ -349,10 +350,10 @@ function Initialize_c()
sky6RASCOMTele.FindHome();
var props = GetRADec("Sun");

WriteLog("Iniciou o slew as");
WriteLog("Iniciou o slew (Initialize_c)");
SlewTelescopeToRaDec(props.ra, props.dec, "Sun");

WriteLog("Iniciou o rastreamento as");
WriteLog("Iniciou o rastreamento (Initialize_c");
}

/**
Expand All @@ -361,10 +362,10 @@ function Initialize_c()
function Flip_c()
{
var props = GetRADec("Sun");
WriteLog("Iniciou o slew(flip) as");
WriteLog("Iniciou o slew (Flip_c)");
SlewTelescopeToRaDec(props.ra, props.dec, "Sun");

WriteLog("Completou o flip as");
WriteLog("Completou o flip (Flip_c)");
}

/**
Expand All @@ -373,18 +374,18 @@ function Flip_c()
function TurnOff_c()
{
SetTelescopeTracking(0, 1, 0, 0);
WriteLog("Desligou o rastreamento as");
WriteLog("Desligou o rastreamento (TurnOff_c)");

ParkTelescope();
WriteLog("Desconectado as");
WriteLog("Desconectado (TurnOff_c)");
}

/**
* Reconecta o telescópio e reinicia o tracking.
*/
function Reconnect_c()
{
WriteLog("(Re)conectado as");
WriteLog("(Re)conectado (Reconnect_c)");
ConnectTelescope();
SetTelescopeTracking(0, 1, 0, 0);
sky6RASCOMTele.FindHome();
Expand All @@ -398,18 +399,18 @@ function RestartTracking_c()
{
var props = GetRADec("Sun");

WriteLog("Iniciou o slew as");
WriteLog("Iniciou o slew (RestartTracking_c)");
SlewTelescopeToRaDec(props.ra, props.dec, "Sun");

WriteLog("Reiniciou o rastreamento as");
WriteLog("Reiniciou o rastreamento (RestartTracking_c)");
}

/**
* Aponta para o céu adicionando a altitude da observação atual
*/
function CalibrateTelescope_c()
{
WriteLog("Calibracao iniciada as")
WriteLog("Calibracao iniciada (CalibrateTelescope_c)")
var delta = 20;
var props = GetAzAlt();
var newAz = props.az + delta;
Expand Down

0 comments on commit e26873f

Please sign in to comment.